author | Tom Tromey <tromey@mozilla.com> |
Mon, 20 Apr 2015 11:42:09 -0700 | |
changeset 240147 | cc1202199a838ac4920c277a4d35ef91e2d2ea98 |
parent 240146 | e622988c2f9802722700313e00cdbe90210a0e88 |
child 240148 | ea910d309969c2cecc0f7dad8ddd12e3cfbff348 |
push id | 58752 |
push user | cbook@mozilla.com |
push date | Tue, 21 Apr 2015 10:39:00 +0000 |
treeherder | mozilla-inbound@b8d59286a581 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | hurley |
bugs | 1096908 |
milestone | 40.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/devtools/webconsole/test/browser.ini +++ b/browser/devtools/webconsole/test/browser.ini @@ -302,17 +302,16 @@ skip-if = buildapp == 'mulet' || e10s # [browser_webconsole_bug_915141_toggle_response_logging_with_keyboard.js] [browser_webconsole_filter_buttons_contextmenu.js] [browser_webconsole_bug_1006027_message_timestamps_incorrect.js] skip-if = e10s # Bug 1042253 - webconsole e10s tests (Linux debug intermittent) [browser_webconsole_bug_1010953_cspro.js] [browser_webconsole_certificate_messages.js] skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s [browser_webconsole_show_subresource_security_errors.js] -skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s [browser_webconsole_cached_autocomplete.js] [browser_webconsole_change_font_size.js] [browser_webconsole_chrome.js] [browser_webconsole_clickable_urls.js] skip-if = e10s # Bug 1042253 - webconsole e10s tests (Linux debug timeout) [browser_webconsole_closure_inspection.js] skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s [browser_webconsole_completion.js]
--- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -177,17 +177,17 @@ public: NS_IMETHOD GetLocalPort(int32_t* port) override; NS_IMETHOD GetRemoteAddress(nsACString& addr) override; NS_IMETHOD GetRemotePort(int32_t* port) override; NS_IMETHOD GetAllowSpdy(bool *aAllowSpdy) override; NS_IMETHOD SetAllowSpdy(bool aAllowSpdy) override; NS_IMETHOD GetAllowAltSvc(bool *aAllowAltSvc) override; NS_IMETHOD SetAllowAltSvc(bool aAllowAltSvc) override; NS_IMETHOD GetApiRedirectToURI(nsIURI * *aApiRedirectToURI) override; - nsresult AddSecurityMessage(const nsAString &aMessageTag, const nsAString &aMessageCategory); + virtual nsresult AddSecurityMessage(const nsAString &aMessageTag, const nsAString &aMessageCategory); NS_IMETHOD TakeAllSecurityMessages(nsCOMArray<nsISecurityConsoleMessage> &aMessages) override; NS_IMETHOD GetResponseTimeoutEnabled(bool *aEnable) override; NS_IMETHOD SetResponseTimeoutEnabled(bool aEnable) override; NS_IMETHOD GetNetworkInterfaceId(nsACString& aNetworkInterfaceId) override; NS_IMETHOD SetNetworkInterfaceId(const nsACString& aNetworkInterfaceId) override; NS_IMETHOD AddRedirect(nsIPrincipal *aRedirect) override; NS_IMETHOD ForcePending(bool aForcePending) override; NS_IMETHOD GetLastModifiedTime(PRTime* lastModifiedTime) override;
--- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -986,16 +986,24 @@ HttpChannelChild::RecvDeleteSelf() } void HttpChannelChild::DeleteSelf() { Send__delete__(this); } +bool +HttpChannelChild::RecvReportSecurityMessage(const nsString& messageTag, + const nsString& messageCategory) +{ + AddSecurityMessage(messageTag, messageCategory); + return true; +} + class Redirect1Event : public ChannelEvent { public: Redirect1Event(HttpChannelChild* child, const uint32_t& newChannelId, const URIParams& newURI, const uint32_t& redirectFlags, const nsHttpResponseHead& responseHead)
--- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -135,16 +135,19 @@ protected: const nsHttpResponseHead& responseHead) override; bool RecvRedirect3Complete() override; bool RecvAssociateApplicationCache(const nsCString& groupID, const nsCString& clientID) override; bool RecvFlushedForDiversion() override; bool RecvDivertMessages() override; bool RecvDeleteSelf() override; + bool RecvReportSecurityMessage(const nsString& messageTag, + const nsString& messageCategory) override; + bool GetAssociatedContentSecurity(nsIAssociatedContentSecurity** res = nullptr); virtual void DoNotifyListenerCleanup() override; private: nsresult ContinueAsyncOpen(); void DoOnStartRequest(nsIRequest* aRequest, nsISupports* aContext); void DoOnStatus(nsIRequest* aRequest, nsresult status);
--- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -324,16 +324,17 @@ HttpChannelParent::DoAsyncOpen( const U nsCOMPtr<nsIChannel> channel; rv = NS_NewChannelInternal(getter_AddRefs(channel), uri, loadInfo, nullptr, nullptr, loadFlags, ios); if (NS_FAILED(rv)) return SendFailedAsyncOpen(rv); mChannel = static_cast<nsHttpChannel *>(channel.get()); + mChannel->SetWarningReporter(this); mChannel->SetTimingEnabled(true); if (mPBOverride != kPBOverride_Unset) { mChannel->SetPrivate(mPBOverride == kPBOverride_Private ? true : false); } if (doResumeAt) mChannel->ResumeAt(startPos, entityID); @@ -1259,9 +1260,24 @@ HttpChannelParent::GetAuthPrompt(uint32_ void** aResult) { nsCOMPtr<nsIAuthPrompt2> prompt = new NeckoParent::NestedFrameAuthPrompt(Manager(), mNestedFrameId); prompt.forget(aResult); return NS_OK; } +//----------------------------------------------------------------------------- +// HttpChannelSecurityWarningReporter +//----------------------------------------------------------------------------- + +nsresult +HttpChannelParent::ReportSecurityMessage(const nsAString& aMessageTag, + const nsAString& aMessageCategory) +{ + if (NS_WARN_IF(!SendReportSecurityMessage(nsString(aMessageTag), + nsString(aMessageCategory)))) { + return NS_ERROR_UNEXPECTED; + } + return NS_OK; +} + }} // mozilla::net
--- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -39,16 +39,17 @@ class HttpChannelParentListener; class HttpChannelParent final : public PHttpChannelParent , public nsIParentRedirectingChannel , public nsIProgressEventSink , public nsIInterfaceRequestor , public ADivertableParentChannel , public nsIAuthPromptProvider , public nsINetworkInterceptController , public DisconnectableParent + , public HttpChannelSecurityWarningReporter { virtual ~HttpChannelParent(); public: NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER NS_DECL_NSIPARENTCHANNEL @@ -149,16 +150,19 @@ protected: void FailDiversion(nsresult aErrorCode, bool aSkipResume = true); friend class HttpChannelParentListener; nsRefPtr<mozilla::dom::TabParent> mTabParent; void OfflineDisconnect() override; uint32_t GetAppId() override; + nsresult ReportSecurityMessage(const nsAString& aMessageTag, + const nsAString& aMessageCategory) override; + private: nsRefPtr<nsHttpChannel> mChannel; nsCOMPtr<nsICacheEntry> mCacheEntry; nsCOMPtr<nsIAssociatedContentSecurity> mAssociatedContentSecurity; bool mIPCClosed; // PHttpChannel actor has been Closed() nsCOMPtr<nsIChannel> mRedirectChannel; nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
--- a/netwerk/protocol/http/PHttpChannel.ipdl +++ b/netwerk/protocol/http/PHttpChannel.ipdl @@ -134,16 +134,20 @@ child: // Parent has been suspended for diversion; no more events to be enqueued. FlushedForDiversion(); // Child should resume processing the ChannelEventQueue, i.e. diverting any // OnDataAvailable and OnStopRequest messages in the queue back to the parent. DivertMessages(); + // Report a security message to the console associated with this + // channel. + ReportSecurityMessage(nsString messageTag, nsString messageCategory); + // Tell child to delete channel (all IPDL deletes must be done from child to // avoid races: see bug 591708). DeleteSelf(); }; } // namespace net } // namespace mozilla
--- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -239,16 +239,17 @@ nsHttpChannel::nsHttpChannel() , mCacheEntryIsWriteOnly(false) , mCacheEntriesToWaitFor(0) , mHasQueryString(0) , mConcurentCacheAccess(0) , mIsPartialRequest(0) , mHasAutoRedirectVetoNotifier(0) , mPushedStream(nullptr) , mLocalBlocklist(false) + , mWarningReporter(nullptr) , mDidReval(false) { LOG(("Creating nsHttpChannel [this=%p]\n", this)); mChannelCreationTime = PR_Now(); mChannelCreationTimestamp = TimeStamp::Now(); } nsHttpChannel::~nsHttpChannel() @@ -276,16 +277,29 @@ nsHttpChannel::Init(nsIURI *uri, proxyResolveFlags, proxyURI); if (NS_FAILED(rv)) return rv; LOG(("nsHttpChannel::Init [this=%p]\n", this)); return rv; } + +nsresult +nsHttpChannel::AddSecurityMessage(const nsAString& aMessageTag, + const nsAString& aMessageCategory) +{ + if (mWarningReporter) { + return mWarningReporter->ReportSecurityMessage(aMessageTag, + aMessageCategory); + } + return HttpBaseChannel::AddSecurityMessage(aMessageTag, + aMessageCategory); +} + //----------------------------------------------------------------------------- // nsHttpChannel <private> //----------------------------------------------------------------------------- nsresult nsHttpChannel::Connect() { nsresult rv;
--- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -28,16 +28,24 @@ class nsDNSPrefetch; class nsICancelable; class nsIHttpChannelAuthProvider; class nsInputStreamPump; class nsISSLStatus; namespace mozilla { namespace net { class Http2PushedStream; + +class HttpChannelSecurityWarningReporter +{ +public: + virtual nsresult ReportSecurityMessage(const nsAString& aMessageTag, + const nsAString& aMessageCategory) = 0; +}; + //----------------------------------------------------------------------------- // nsHttpChannel //----------------------------------------------------------------------------- // Use to support QI nsIChannel to nsHttpChannel #define NS_HTTPCHANNEL_IID \ { \ 0x301bf95b, \ @@ -136,16 +144,22 @@ public: NS_IMETHOD GetDomainLookupStart(mozilla::TimeStamp *aDomainLookupStart) override; NS_IMETHOD GetDomainLookupEnd(mozilla::TimeStamp *aDomainLookupEnd) override; NS_IMETHOD GetConnectStart(mozilla::TimeStamp *aConnectStart) override; NS_IMETHOD GetConnectEnd(mozilla::TimeStamp *aConnectEnd) override; NS_IMETHOD GetRequestStart(mozilla::TimeStamp *aRequestStart) override; NS_IMETHOD GetResponseStart(mozilla::TimeStamp *aResponseStart) override; NS_IMETHOD GetResponseEnd(mozilla::TimeStamp *aResponseEnd) override; + nsresult AddSecurityMessage(const nsAString& aMessageTag, + const nsAString& aMessageCategory) override; + + void SetWarningReporter(HttpChannelSecurityWarningReporter* aReporter) + { mWarningReporter = aReporter; } + public: /* internal necko use only */ void InternalSetUploadStream(nsIInputStream *uploadStream) { mUploadStream = uploadStream; } void SetUploadStreamHasHeaders(bool hasHeaders) { mUploadStreamHasHeaders = hasHeaders; } nsresult SetReferrerWithPolicyInternal(nsIURI *referrer, @@ -472,16 +486,19 @@ private: bool mLocalBlocklist; nsresult WaitForRedirectCallback(); void PushRedirectAsyncFunc(nsContinueRedirectionFunc func); void PopRedirectAsyncFunc(nsContinueRedirectionFunc func); nsCString mUsername; + // If non-null, warnings should be reported to this object. + HttpChannelSecurityWarningReporter* mWarningReporter; + protected: virtual void DoNotifyListenerCleanup() override; private: // cache telemetry bool mDidReval; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsHttpChannel, NS_HTTPCHANNEL_IID)