Merge mozilla-central to autoland. a=merge on a CLOSED TREE

This commit is contained in:
Razvan Maries 2018-12-04 23:59:45 +02:00
commit f53637a09f
63 changed files with 217 additions and 614 deletions

View file

@ -303,8 +303,7 @@ DocManager::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
NS_IMETHODIMP NS_IMETHODIMP
DocManager::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, DocManager::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aOldState, uint32_t aState, uint32_t aState) {
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -717,8 +717,7 @@ var ContentBlocking = {
Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD").add(value); Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD").add(value);
}, },
onSecurityChange(oldState, state, webProgress, isSimulated, onSecurityChange(state, webProgress, isSimulated) {
contentBlockingLogJSON) {
let baseURI = this._baseURIForChannelClassifier; let baseURI = this._baseURIForChannelClassifier;
// Don't deal with about:, file: etc. // Don't deal with about:, file: etc.

View file

@ -4927,8 +4927,7 @@ var XULBrowserWindow = {
// 3. Called directly during this object's initializations. // 3. Called directly during this object's initializations.
// aRequest will be null always in case 2 and 3, and sometimes in case 1 (for // aRequest will be null always in case 2 and 3, and sometimes in case 1 (for
// instance, there won't be a request when STATE_BLOCKED_TRACKING_CONTENT is observed). // instance, there won't be a request when STATE_BLOCKED_TRACKING_CONTENT is observed).
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState, aIsSimulated) {
aContentBlockingLogJSON, aIsSimulated) {
// Don't need to do anything if the data we use to update the UI hasn't // Don't need to do anything if the data we use to update the UI hasn't
// changed // changed
let uri = gBrowser.currentURI; let uri = gBrowser.currentURI;
@ -4955,8 +4954,7 @@ var XULBrowserWindow = {
uri = Services.uriFixup.createExposableURI(uri); uri = Services.uriFixup.createExposableURI(uri);
} catch (e) {} } catch (e) {}
gIdentityHandler.updateIdentity(this._state, uri); gIdentityHandler.updateIdentity(this._state, uri);
ContentBlocking.onSecurityChange(aOldState, this._state, aWebProgress, aIsSimulated, ContentBlocking.onSecurityChange(this._state, aWebProgress, aIsSimulated);
aContentBlockingLogJSON);
}, },
// simulate all change notifications after switching tabs // simulate all change notifications after switching tabs

View file

@ -962,13 +962,8 @@ window._gBrowser = {
if (securityUI) { if (securityUI) {
// Include the true final argument to indicate that this event is // Include the true final argument to indicate that this event is
// simulated (instead of being observed by the webProgressListener). // simulated (instead of being observed by the webProgressListener).
// Note: check state first to make sure the security UI object updates its
// state from the docshell correctly.
let state = securityUI.state;
let oldState = securityUI.oldState;
this._callProgressListeners(null, "onSecurityChange", this._callProgressListeners(null, "onSecurityChange",
[webProgress, null, oldState, state, [webProgress, null, securityUI.state, true],
securityUI.contentBlockingLogJSON, true],
true, false); true, false);
} }
@ -1713,17 +1708,12 @@ window._gBrowser = {
// Restore the securityUI state. // Restore the securityUI state.
let securityUI = aBrowser.securityUI; let securityUI = aBrowser.securityUI;
// Make sure to call the state getter before the oldState getter to give
// the securityUI object a chance to sync its state with the docshell
let state = securityUI ? securityUI.state : let state = securityUI ? securityUI.state :
Ci.nsIWebProgressListener.STATE_IS_INSECURE; Ci.nsIWebProgressListener.STATE_IS_INSECURE;
let oldState = securityUI ? securityUI.oldState :
Ci.nsIWebProgressListener.STATE_IS_INSECURE;
// Include the true final argument to indicate that this event is // Include the true final argument to indicate that this event is
// simulated (instead of being observed by the webProgressListener). // simulated (instead of being observed by the webProgressListener).
this._callProgressListeners(aBrowser, "onSecurityChange", this._callProgressListeners(aBrowser, "onSecurityChange",
[aBrowser.webProgress, null, oldState, state, [aBrowser.webProgress, null, state, true],
securityUI.contentBlockingLogJSON, true],
true, false); true, false);
if (aShouldBeRemote) { if (aShouldBeRemote) {
@ -5206,10 +5196,9 @@ class TabProgressListener {
this.mMessage = aMessage; this.mMessage = aMessage;
} }
onSecurityChange(aWebProgress, aRequest, aOldState, aState, aContentBlockingLogJSON) { onSecurityChange(aWebProgress, aRequest, aState) {
this._callProgressListeners("onSecurityChange", this._callProgressListeners("onSecurityChange",
[aWebProgress, aRequest, aOldState, aState, [aWebProgress, aRequest, aState]);
aContentBlockingLogJSON]);
} }
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) { onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {

View file

@ -36,8 +36,7 @@ var gFrontProgressListener = {
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) { onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
}, },
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
if (aRequest && if (aRequest &&
aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") { aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
// ignore initial about blank // ignore initial about blank
@ -96,8 +95,7 @@ var gAllProgressListener = {
ok(aBrowser == gTestBrowser, state + " notification came from the correct browser"); ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
}, },
onSecurityChange(aBrowser, aWebProgress, aRequest, aOldState, aState, onSecurityChange(aBrowser, aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
if (aRequest && if (aRequest &&
aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") { aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec == "about:blank") {
// ignore initial about blank // ignore initial about blank

View file

@ -1221,8 +1221,7 @@ this.tabs = class extends ExtensionAPI {
let printProgressListener = { let printProgressListener = {
onLocationChange(webProgress, request, location, flags) { }, onLocationChange(webProgress, request, location, flags) { },
onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) { }, onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) { },
onSecurityChange(webProgress, request, oldState, state, onSecurityChange(webProgress, request, state) { },
contentBlockingLogJSON) { },
onStateChange(webProgress, request, flags, status) { onStateChange(webProgress, request, flags, status) {
if ((flags & Ci.nsIWebProgressListener.STATE_STOP) && (flags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT)) { if ((flags & Ci.nsIWebProgressListener.STATE_STOP) && (flags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT)) {
resolve(retval == 0 ? "saved" : "replaced"); resolve(retval == 0 ? "saved" : "replaced");

View file

@ -76,7 +76,9 @@ var StartupPerformance = {
// Record the start timestamp, setup the timer and `this._promiseFinished`. // Record the start timestamp, setup the timer and `this._promiseFinished`.
// Behavior is unspecified if there was already an ongoing measure. // Behavior is unspecified if there was already an ongoing measure.
_onRestorationStarts(isAutoRestore) { _onRestorationStarts(isAutoRestore) {
Services.profiler.AddMarker("_onRestorationStarts"); if (Services.profiler) {
Services.profiler.AddMarker("_onRestorationStarts");
}
this._latestRestoredTimeStamp = this._startTimeStamp = Date.now(); this._latestRestoredTimeStamp = this._startTimeStamp = Date.now();
this._totalNumberOfEagerTabs = 0; this._totalNumberOfEagerTabs = 0;
this._totalNumberOfTabs = 0; this._totalNumberOfTabs = 0;
@ -199,7 +201,9 @@ var StartupPerformance = {
// to the user switching to a lazily restored tab, or for tabs // to the user switching to a lazily restored tab, or for tabs
// that are restoring eagerly. // that are restoring eagerly.
if (!event.detail.isRemotenessUpdate) { if (!event.detail.isRemotenessUpdate) {
Services.profiler.AddMarker("SSTabRestored"); if (Services.profiler) {
Services.profiler.AddMarker("SSTabRestored");
}
this._latestRestoredTimeStamp = Date.now(); this._latestRestoredTimeStamp = Date.now();
this._totalNumberOfEagerTabs += 1; this._totalNumberOfEagerTabs += 1;
} }

View file

@ -184,9 +184,7 @@ nsMacShellService::OnStatusChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
nsMacShellService::OnSecurityChange(nsIWebProgress* aWebProgress, nsMacShellService::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t aState) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
return NS_OK; return NS_OK;
} }

View file

@ -6630,8 +6630,7 @@ nsDocShell::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsDocShell::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aOldState, uint32_t aState, uint32_t aState) {
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -694,9 +694,8 @@ nsDocShellTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShellTreeOwner::OnSecurityChange( nsDocShellTreeOwner::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t aState) {
uint32_t aState, const nsAString& aContentBlockingLogJSON) {
return NS_OK; return NS_OK;
} }

View file

@ -5075,8 +5075,7 @@ void nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
return; return;
} }
eventSink->OnSecurityChange(aChannel, oldState, state, eventSink->OnSecurityChange(aChannel, state);
doc->GetContentBlockingLog());
} }
// static // static

View file

@ -1181,8 +1181,7 @@ BrowserElementChild.prototype = {
} }
}, },
onSecurityChange: function(webProgress, request, oldState, state, onSecurityChange: function(webProgress, request, state) {
contentBlockingLogJSON) {
if (webProgress != docShell) { if (webProgress != docShell) {
return; return;
} }

View file

@ -121,8 +121,7 @@ class NavigateLoadListener final : public nsIWebProgressListener,
NS_IMETHOD NS_IMETHOD
OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aOldState, uint32_t aState, uint32_t aState) override {
const nsAString& aContentBlockingLogJSON) override {
MOZ_CRASH("Unexpected notification."); MOZ_CRASH("Unexpected notification.");
return NS_OK; return NS_OK;
} }

View file

@ -117,8 +117,7 @@ class WebProgressListener final : public nsIWebProgressListener,
NS_IMETHOD NS_IMETHOD
OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aOldState, uint32_t aState, uint32_t aState) override {
const nsAString& aContentBlockingLogJSON) override {
MOZ_ASSERT(false, "Unexpected notification."); MOZ_ASSERT(false, "Unexpected notification.");
return NS_OK; return NS_OK;
} }

View file

@ -1995,9 +1995,7 @@ HTMLFormElement::OnStatusChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
HTMLFormElement::OnSecurityChange(nsIWebProgress* aWebProgress, HTMLFormElement::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t state) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -504,9 +504,9 @@ nsHTMLDNSPrefetch::nsDeferrals::OnStatusChange(nsIWebProgress *aWebProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnSecurityChange( nsHTMLDNSPrefetch::nsDeferrals::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aOldState, nsIRequest *aRequest,
uint32_t aState, const nsAString &aContentBlockingLogJSON) { uint32_t state) {
return NS_OK; return NS_OK;
} }

View file

@ -235,8 +235,7 @@ PresentationResponderLoadingCallback::OnStatusChange(
NS_IMETHODIMP NS_IMETHODIMP
PresentationResponderLoadingCallback::OnSecurityChange( PresentationResponderLoadingCallback::OnSecurityChange(
nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aOldState, nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t state) {
uint32_t aState, const nsAString& aContentBlockingLogJSON) {
// Do nothing. // Do nothing.
return NS_OK; return NS_OK;
} }

View file

@ -102,7 +102,6 @@ class nsMixedContentEvent : public Runnable {
nsCOMPtr<nsIDocument> rootDoc = sameTypeRoot->GetDocument(); nsCOMPtr<nsIDocument> rootDoc = sameTypeRoot->GetDocument();
NS_ASSERTION(rootDoc, NS_ASSERTION(rootDoc,
"No root document from document shell root tree item."); "No root document from document shell root tree item.");
ContentBlockingLog* contentBlockingLog = rootDoc->GetContentBlockingLog();
// Get eventSink and the current security state from the docShell // Get eventSink and the current security state from the docShell
nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell); nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell);
@ -146,18 +145,16 @@ class nsMixedContentEvent : public Runnable {
} }
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
mContext, state, mContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT));
contentBlockingLog);
} else { } else {
// root not secure, mixed active content loaded in an https subframe // root not secure, mixed active content loaded in an https subframe
if (NS_SUCCEEDED(stateRV)) { if (NS_SUCCEEDED(stateRV)) {
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
mContext, state, mContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT));
contentBlockingLog);
} }
} }
} }
@ -188,18 +185,16 @@ class nsMixedContentEvent : public Runnable {
} }
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
mContext, state, mContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
contentBlockingLog);
} else { } else {
// root not secure, mixed display content loaded in an https subframe // root not secure, mixed display content loaded in an https subframe
if (NS_SUCCEEDED(stateRV)) { if (NS_SUCCEEDED(stateRV)) {
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
mContext, state, mContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
contentBlockingLog);
} }
} }
} }
@ -900,7 +895,6 @@ nsresult nsMixedContentBlocker::ShouldLoad(
// Get the root document from the sameTypeRoot // Get the root document from the sameTypeRoot
nsCOMPtr<nsIDocument> rootDoc = sameTypeRoot->GetDocument(); nsCOMPtr<nsIDocument> rootDoc = sameTypeRoot->GetDocument();
NS_ASSERTION(rootDoc, "No root document from document shell root tree item."); NS_ASSERTION(rootDoc, "No root document from document shell root tree item.");
ContentBlockingLog* contentBlockingLog = rootDoc->GetContentBlockingLog();
// Get eventSink and the current security state from the docShell // Get eventSink and the current security state from the docShell
nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell); nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell);
@ -991,19 +985,17 @@ nsresult nsMixedContentBlocker::ShouldLoad(
} }
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
contentBlockingLog);
} else { } else {
// User has overriden the pref and the root is not https; // User has overriden the pref and the root is not https;
// mixed display content was allowed on an https subframe. // mixed display content was allowed on an https subframe.
if (NS_SUCCEEDED(stateRV)) { if (NS_SUCCEEDED(stateRV)) {
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
contentBlockingLog);
} }
} }
} else { } else {
@ -1014,10 +1006,9 @@ nsresult nsMixedContentBlocker::ShouldLoad(
NS_SUCCEEDED(stateRV)) { NS_SUCCEEDED(stateRV)) {
rootDoc->SetHasMixedDisplayContentBlocked(true); rootDoc->SetHasMixedDisplayContentBlocked(true);
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | (state |
nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT), nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT));
contentBlockingLog);
} }
} }
return NS_OK; return NS_OK;
@ -1049,9 +1040,9 @@ nsresult nsMixedContentBlocker::ShouldLoad(
} }
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT), (state |
contentBlockingLog); nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT));
return NS_OK; return NS_OK;
} else { } else {
@ -1059,10 +1050,9 @@ nsresult nsMixedContentBlocker::ShouldLoad(
// mixed active content was allowed on an https subframe. // mixed active content was allowed on an https subframe.
if (NS_SUCCEEDED(stateRV)) { if (NS_SUCCEEDED(stateRV)) {
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | (state |
nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT), nsIWebProgressListener::STATE_LOADED_MIXED_ACTIVE_CONTENT));
contentBlockingLog);
} }
return NS_OK; return NS_OK;
} }
@ -1083,10 +1073,9 @@ nsresult nsMixedContentBlocker::ShouldLoad(
// option by calling eventSink which will invoke the doorhanger // option by calling eventSink which will invoke the doorhanger
if (NS_SUCCEEDED(stateRV)) { if (NS_SUCCEEDED(stateRV)) {
eventSink->OnSecurityChange( eventSink->OnSecurityChange(
aRequestingContext, state, aRequestingContext,
(state | (state |
nsIWebProgressListener::STATE_BLOCKED_MIXED_ACTIVE_CONTENT), nsIWebProgressListener::STATE_BLOCKED_MIXED_ACTIVE_CONTENT));
contentBlockingLog);
} }
return NS_OK; return NS_OK;
} }

View file

@ -787,9 +787,7 @@ nsEditingSession::OnStatusChange(nsIWebProgress* aWebProgress,
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
NS_IMETHODIMP NS_IMETHODIMP
nsEditingSession::OnSecurityChange(nsIWebProgress* aWebProgress, nsEditingSession::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t state) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -87,8 +87,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=434998
{ {
}, },
onSecurityChange : function(aWebProgress, aRequest, aOldState, aState, onSecurityChange : function(aWebProgress, aRequest, aState)
aContentBlockingLogJSON)
{ {
}, },

View file

@ -93,8 +93,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
{ {
}, },
onSecurityChange : function(aWebProgress, aRequest, aOldState, aState, onSecurityChange : function(aWebProgress, aRequest, aState)
aContentBlockingLogJSON)
{ {
}, },

View file

@ -82,8 +82,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
{ {
}, },
onSecurityChange : function(aWebProgress, aRequest, aOldState, aState, onSecurityChange : function(aWebProgress, aRequest, aState)
aContentBlockingLogJSON)
{ {
}, },

View file

@ -91,8 +91,7 @@ adapted from test_bug607584.xul by Kent James <kent@caspia.com>
{ {
}, },
onSecurityChange : function(aWebProgress, aRequest, aOldState, aState, onSecurityChange : function(aWebProgress, aRequest, aState)
aContentBlockingLogJSON)
{ {
}, },

View file

@ -23,8 +23,7 @@ function printpreview() {
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
maxSelfProgress, curTotalProgress, maxSelfProgress, curTotalProgress,
maxTotalProgress) { }, maxTotalProgress) { },
onSecurityChange: function(webProgress, request, oldState, state, onSecurityChange: function(webProgress, request, state) { },
contentBlockingLogJSON) { },
onStateChange: function(webProgress, request, stateFlags, status) { }, onStateChange: function(webProgress, request, stateFlags, status) { },
onStatusChange: function(webProgress, request, status, message) { }, onStatusChange: function(webProgress, request, status, message) { },
QueryInterface: function(iid) { QueryInterface: function(iid) {

View file

@ -23,8 +23,7 @@ function printpreview() {
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
maxSelfProgress, curTotalProgress, maxSelfProgress, curTotalProgress,
maxTotalProgress) { }, maxTotalProgress) { },
onSecurityChange: function(webProgress, request, oldState, state, onSecurityChange: function(webProgress, request, state) { },
contentBlockingLogJSON) { },
onStateChange: function(webProgress, request, stateFlags, status) { }, onStateChange: function(webProgress, request, stateFlags, status) { },
onStatusChange: function(webProgress, request, status, message) { }, onStatusChange: function(webProgress, request, status, message) { },
QueryInterface: function(iid) { QueryInterface: function(iid) {

View file

@ -30,8 +30,7 @@ function printpreview() {
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
maxSelfProgress, curTotalProgress, maxSelfProgress, curTotalProgress,
maxTotalProgress) { }, maxTotalProgress) { },
onSecurityChange: function(webProgress, request, oldState, state, onSecurityChange: function(webProgress, request, state) { },
contentBlockingLogJSON) { },
onStateChange: function(webProgress, request, stateFlags, status) { }, onStateChange: function(webProgress, request, stateFlags, status) { },
onStatusChange: function(webProgress, request, status, message) { }, onStatusChange: function(webProgress, request, status, message) { },
QueryInterface: function(iid) { QueryInterface: function(iid) {

View file

@ -139,9 +139,8 @@ RemotePrintJobChild::OnStatusChange(nsIWebProgress* aProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
RemotePrintJobChild::OnSecurityChange( RemotePrintJobChild::OnSecurityChange(nsIWebProgress* aProgress,
nsIWebProgress* aProgress, nsIRequest* aRequest, uint32_t aState, nsIRequest* aRequest, uint32_t aState) {
uint32_t aOldState, const nsAString& aContentBlockingLogJSON) {
return NS_OK; return NS_OK;
} }

View file

@ -2018,8 +2018,7 @@ nsPrintJob::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
NS_IMETHODIMP NS_IMETHODIMP
nsPrintJob::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsPrintJob::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aState, uint32_t aOldState, uint32_t aState) {
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -77,8 +77,7 @@ nsLDBBrowserContentListener.prototype = {
this.mStatusText.value = aMessage; this.mStatusText.value = aMessage;
}, },
onSecurityChange : function(aWebProgress, aRequest, aOldState, aState, onSecurityChange : function(aWebProgress, aRequest, aState)
aContentBlockingLogJSON)
{ {
}, },

View file

@ -4725,8 +4725,7 @@ Tab.prototype = {
_state: null, _state: null,
_hostChanged: false, // onLocationChange will flip this bit _hostChanged: false, // onLocationChange will flip this bit
onSecurityChange: function(aWebProgress, aRequest, aOldState, aState, onSecurityChange: function(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
// Don't need to do anything if the data we use to update the UI hasn't changed // Don't need to do anything if the data we use to update the UI hasn't changed
if (this._state == aState && !this._hostChanged) if (this._state == aState && !this._hostChanged)
return; return;

View file

@ -253,8 +253,7 @@ class GeckoViewProgress extends GeckoViewModule {
} }
} }
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
debug `onSecurityChange`; debug `onSecurityChange`;
// Don't need to do anything if the data we use to update the UI hasn't changed // Don't need to do anything if the data we use to update the UI hasn't changed

View file

@ -20,8 +20,7 @@ class GeckoViewTrackingProtection extends GeckoViewModule {
this.browser.addProgressListener(this.progressFilter, flags); this.browser.addProgressListener(this.progressFilter, flags);
} }
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
debug `onSecurityChange`; debug `onSecurityChange`;
if (!(aState & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) || if (!(aState & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) ||

View file

@ -14,32 +14,7 @@ interface nsISecureBrowserUI : nsISupports
{ {
void init(in nsIDocShell docShell); void init(in nsIDocShell docShell);
// A value composed of the Security State Flags and the Security
// Strength Flags defined in nsIWebProgressListener.
// Any undefined bits are reserved for future use.
// This represents the security state before the change.
readonly attribute unsigned long oldState;
// A value composed of the Security State Flags and the Security
// Strength Flags defined in nsIWebProgressListener.
// Any undefined bits are reserved for future use.
// This represents the security state after the change.
readonly attribute unsigned long state; readonly attribute unsigned long state;
// An optional JSON string representing a log of the content blocking
// events happened so far. This will be a JSON object containing keys
// representing origins that content blocking has acted on, with values
// being an array of items, each representing one action. Each action
// itself is an an array containing three elements, the first element
// being a blocking code from one of the Security State Flags above, and
// the second element being a boolean representing whether the origin
// was blocked (if true) or unblocked (if false) in that category, and
// the third element being the number of times that combination has been
// repeated consecutively.
// The reason JSON strings was chosen here was that we needed a format
// that is transferrable across processes in JS; and also the consumer
// of this data (browser-contentblocking.js) would be able to use the
// JSON.parse() API to parse out an object representation of the value.
readonly attribute AString contentBlockingLogJSON;
// Information about the connection security.
readonly attribute nsITransportSecurityInfo secInfo; readonly attribute nsITransportSecurityInfo secInfo;
}; };

View file

@ -4,16 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIURI;
%{ C++
namespace mozilla {
namespace dom {
class ContentBlockingLog;
}
}
%}
[ptr] native ContentBlockingLog(mozilla::dom::ContentBlockingLog);
[builtinclass, uuid(a71aee68-dd38-4736-bd79-035fea1a1ec6)] [builtinclass, uuid(a71aee68-dd38-4736-bd79-035fea1a1ec6)]
interface nsISecurityEventSink : nsISupports interface nsISecurityEventSink : nsISupports
@ -25,13 +16,9 @@ interface nsISecurityEventSink : nsISupports
* a security package (eg Netscape Personal Security Manager) * a security package (eg Netscape Personal Security Manager)
* to notify nsIWebProgressListeners that security state has * to notify nsIWebProgressListeners that security state has
* changed. State flags are in nsIWebProgressListener.idl * changed. State flags are in nsIWebProgressListener.idl
* The old state flags before the change must also be passed in.
* cbLog represents the log of the content blocking actions on
* the page so far.
*/ */
void onSecurityChange(in nsISupports i_Context, in unsigned long oldState, void onSecurityChange(in nsISupports i_Context, in unsigned long state);
in unsigned long state, in ContentBlockingLog cbLog);
}; };

View file

@ -21,7 +21,7 @@ using namespace mozilla;
LazyLogModule gSecureBrowserUILog("nsSecureBrowserUI"); LazyLogModule gSecureBrowserUILog("nsSecureBrowserUI");
nsSecureBrowserUIImpl::nsSecureBrowserUIImpl() : mOldState(0), mState(0) { nsSecureBrowserUIImpl::nsSecureBrowserUIImpl() : mState(0) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
} }
@ -57,19 +57,6 @@ nsSecureBrowserUIImpl::Init(nsIDocShell* aDocShell) {
return wp->AddProgressListener(this, nsIWebProgress::NOTIFY_LOCATION); return wp->AddProgressListener(this, nsIWebProgress::NOTIFY_LOCATION);
} }
NS_IMETHODIMP
nsSecureBrowserUIImpl::GetOldState(uint32_t* aOldState) {
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_ARG(aOldState);
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug, ("GetOldState %p", this));
// Only sync our state with the docshell in GetState().
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug, (" mOldState: %x", mOldState));
*aOldState = mOldState;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsSecureBrowserUIImpl::GetState(uint32_t* aState) { nsSecureBrowserUIImpl::GetState(uint32_t* aState) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -86,28 +73,6 @@ nsSecureBrowserUIImpl::GetState(uint32_t* aState) {
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsSecureBrowserUIImpl::GetContentBlockingLogJSON(
nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
("GetContentBlockingLogJSON %p", this));
aContentBlockingLogJSON.Truncate();
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell);
if (docShell) {
nsIDocument* doc = docShell->GetDocument();
if (doc) {
aContentBlockingLogJSON = doc->GetContentBlockingLog()->Stringify();
}
}
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" ContentBlockingLogJSON: %s",
NS_ConvertUTF16toUTF8(aContentBlockingLogJSON).get()));
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsSecureBrowserUIImpl::GetSecInfo(nsITransportSecurityInfo** result) { nsSecureBrowserUIImpl::GetSecInfo(nsITransportSecurityInfo** result) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -142,8 +107,6 @@ void nsSecureBrowserUIImpl::CheckForBlockedContent() {
} }
} }
mOldState = mState;
// Has mixed content been loaded or blocked in nsMixedContentBlocker? // Has mixed content been loaded or blocked in nsMixedContentBlocker?
// This only applies to secure documents even if they're affected by mixed // This only applies to secure documents even if they're affected by mixed
// content blocking in which case the STATE_IS_BROKEN bit would be set rather // content blocking in which case the STATE_IS_BROKEN bit would be set rather
@ -388,7 +351,6 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
return NS_OK; return NS_OK;
} }
mOldState = 0;
mState = 0; mState = 0;
mTopLevelSecurityInfo = nullptr; mTopLevelSecurityInfo = nullptr;
@ -415,21 +377,12 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
} }
} }
mozilla::dom::ContentBlockingLog* contentBlockingLog = nullptr;
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell); nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell);
if (docShell) {
nsIDocument* doc = docShell->GetDocument();
if (doc) {
contentBlockingLog = doc->GetContentBlockingLog();
}
}
nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell); nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell);
if (eventSink) { if (eventSink) {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug, MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" calling OnSecurityChange %p %x", aRequest, mState)); (" calling OnSecurityChange %p %x", aRequest, mState));
Unused << eventSink->OnSecurityChange(aRequest, mOldState, mState, Unused << eventSink->OnSecurityChange(aRequest, mState);
contentBlockingLog);
} else { } else {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug, MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" no docShell or couldn't QI it to nsISecurityEventSink?")); (" no docShell or couldn't QI it to nsISecurityEventSink?"));
@ -460,8 +413,7 @@ nsSecureBrowserUIImpl::OnStatusChange(nsIWebProgress*, nsIRequest*, nsresult,
} }
nsresult nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress*, nsIRequest*, nsresult nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress*, nsIRequest*,
uint32_t, uint32_t, uint32_t) {
const nsAString&) {
MOZ_ASSERT_UNREACHABLE("Should have been excluded in AddProgressListener()"); MOZ_ASSERT_UNREACHABLE("Should have been excluded in AddProgressListener()");
return NS_OK; return NS_OK;
} }

View file

@ -34,14 +34,12 @@ class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
protected: protected:
virtual ~nsSecureBrowserUIImpl(){}; virtual ~nsSecureBrowserUIImpl(){};
// Do mixed content and tracking protection checks. May update mState and // Do mixed content and tracking protection checks. May update mState.
// mOldState.
void CheckForBlockedContent(); void CheckForBlockedContent();
// Given some information about a request from an OnLocationChange event, // Given some information about a request from an OnLocationChange event,
// update mState, mOldState and mTopLevelSecurityInfo. // update mState and mTopLevelSecurityInfo.
nsresult UpdateStateAndSecurityInfo(nsIChannel* channel, nsIURI* uri); nsresult UpdateStateAndSecurityInfo(nsIChannel* channel, nsIURI* uri);
uint32_t mOldState;
uint32_t mState; uint32_t mState;
nsWeakPtr mDocShell; nsWeakPtr mDocShell;
nsWeakPtr mWebProgress; nsWeakPtr mWebProgress;

View file

@ -80,26 +80,31 @@ class AwsyTestCase(MarionetteTestCase):
def tearDown(self): def tearDown(self):
MarionetteTestCase.tearDown(self) MarionetteTestCase.tearDown(self)
self.logger.info("processing data in %s!" % self._resultsDir) try:
perf_blob = process_perf_data.create_perf_data( self.logger.info("processing data in %s!" % self._resultsDir)
self._resultsDir, self.perf_suites(), perf_blob = process_perf_data.create_perf_data(
self.perf_checkpoints()) self._resultsDir, self.perf_suites(),
self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob)) self.perf_checkpoints())
self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob))
perf_file = os.path.join(self._resultsDir, "perfherder_data.json") perf_file = os.path.join(self._resultsDir, "perfherder_data.json")
with open(perf_file, 'w') as fp: with open(perf_file, 'w') as fp:
json.dump(perf_blob, fp, indent=2) json.dump(perf_blob, fp, indent=2)
self.logger.info("Perfherder data written to %s" % perf_file) self.logger.info("Perfherder data written to %s" % perf_file)
except:
raise
finally:
# Make sure we cleanup and upload any existing files even if there
# were errors processing the perf data.
if self._dmd:
self.cleanup_dmd()
if self._dmd: # copy it to moz upload dir if set
self.cleanup_dmd() if 'MOZ_UPLOAD_DIR' in os.environ:
for file in os.listdir(self._resultsDir):
# copy it to moz upload dir if set file = os.path.join(self._resultsDir, file)
if 'MOZ_UPLOAD_DIR' in os.environ: if os.path.isfile(file):
for file in os.listdir(self._resultsDir): shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
file = os.path.join(self._resultsDir, file)
if os.path.isfile(file):
shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
def cleanup_dmd(self): def cleanup_dmd(self):
""" """

View file

@ -1,6 +0,0 @@
[abort.any.worker.html]
disabled:
if os == "android": https://bugzilla.mozilla.org/show_bug.cgi?id=1499003
[abort.any.html]

View file

@ -421,6 +421,5 @@ PrintingListener.prototype = {
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {}, onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {},
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {}, onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {},
aContentBlockingLogJSON) {},
}; };

View file

@ -17,7 +17,7 @@ async function onModifyRequest() {
let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel); let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
let spec = httpChannel.URI.spec; let spec = httpChannel.URI.spec;
info("Observed channel for " + spec); info("Observed channel for " + spec);
if (httpChannel.URI.prePath != TEST_3RD_PARTY_DOMAIN_TP) { if (httpChannel.URI.prePath + "/" != TEST_3RD_PARTY_DOMAIN_TP) {
return; return;
} }
if (spec.endsWith("empty.js")) { if (spec.endsWith("empty.js")) {

View file

@ -185,7 +185,7 @@ add_task(async function() {
let log = JSON.parse(await browser.getContentBlockingLog()); let log = JSON.parse(await browser.getContentBlockingLog());
for (let trackerOrigin in log) { for (let trackerOrigin in log) {
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported"); is(trackerOrigin + "/", TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
let originLog = log[trackerOrigin]; let originLog = log[trackerOrigin];
is(originLog.length, 4, "We should have 4 entries in the compressed log"); is(originLog.length, 4, "We should have 4 entries in the compressed log");
expectTrackerFound(originLog[0]); expectTrackerFound(originLog[0]);

View file

@ -1,15 +1,15 @@
const TEST_DOMAIN = "http://example.net"; const TEST_DOMAIN = "http://example.net/";
const TEST_DOMAIN_2 = "http://xn--exmple-cua.test"; const TEST_DOMAIN_2 = "http://xn--exmple-cua.test/";
const TEST_DOMAIN_3 = "https://xn--hxajbheg2az3al.xn--jxalpdlp"; const TEST_DOMAIN_3 = "https://xn--hxajbheg2az3al.xn--jxalpdlp/";
const TEST_DOMAIN_4 = "http://prefixexample.com"; const TEST_DOMAIN_4 = "http://prefixexample.com/";
const TEST_DOMAIN_5 = "http://test"; const TEST_DOMAIN_5 = "http://test/";
const TEST_DOMAIN_6 = "http://mochi.test:8888"; const TEST_DOMAIN_6 = "http://mochi.test:8888/";
const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org"; const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org/";
const TEST_3RD_PARTY_DOMAIN_TP = "https://tracking.example.com"; const TEST_3RD_PARTY_DOMAIN_TP = "https://tracking.example.com/";
const TEST_4TH_PARTY_DOMAIN = "http://not-tracking.example.com"; const TEST_4TH_PARTY_DOMAIN = "http://not-tracking.example.com/";
const TEST_ANOTHER_3RD_PARTY_DOMAIN = "https://another-tracking.example.net"; const TEST_ANOTHER_3RD_PARTY_DOMAIN = "https://another-tracking.example.net/";
const TEST_PATH = "/browser/toolkit/components/antitracking/test/browser/"; const TEST_PATH = "browser/toolkit/components/antitracking/test/browser/";
const TEST_TOP_PAGE = TEST_DOMAIN + TEST_PATH + "page.html"; const TEST_TOP_PAGE = TEST_DOMAIN + TEST_PATH + "page.html";
const TEST_TOP_PAGE_2 = TEST_DOMAIN_2 + TEST_PATH + "page.html"; const TEST_TOP_PAGE_2 = TEST_DOMAIN_2 + TEST_PATH + "page.html";
@ -35,7 +35,7 @@ var gFeatures = undefined;
let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {}); let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
requestLongerTimeout(5); requestLongerTimeout(3);
this.AntiTracking = { this.AntiTracking = {
runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs, runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs,
@ -230,8 +230,7 @@ this.AntiTracking = {
// get blocked with user interaction present // get blocked with user interaction present
if (userInteractionTest) { if (userInteractionTest) {
this._createUserInteractionTask(name, callbackTracking, callbackNonTracking, this._createUserInteractionTask(name, callbackTracking, callbackNonTracking,
runInPrivateWindow, iframeSandbox, runInPrivateWindow, iframeSandbox, extraPrefs);
expectedBlockingNotifications, extraPrefs);
this._createCleanupTask(cleanupFunction); this._createCleanupTask(cleanupFunction);
} }
} }
@ -300,94 +299,10 @@ this.AntiTracking = {
let cookieBlocked = 0; let cookieBlocked = 0;
let listener = { let listener = {
onSecurityChange(webProgress, request, oldState, state, onSecurityChange(webProgress, request, state) {
contentBlockingLogJSON) {
if ((state & options.expectedBlockingNotifications)) { if ((state & options.expectedBlockingNotifications)) {
++cookieBlocked; ++cookieBlocked;
} }
let contentBlockingLog = {};
try {
contentBlockingLog = JSON.parse(contentBlockingLogJSON);
} catch (e) {
}
let trackerInteractionHelper = false;
if (request) {
request.QueryInterface(Ci.nsIChannel);
trackerInteractionHelper = request.URI.spec.endsWith("?messageme");
}
// If this is the first cookie to be blocked, our state should have
// just changed, otherwise it should have previously contained one of
// the blocking flag too.
if (options.expectedBlockingNotifications && cookieBlocked &&
!options.allowList && !trackerInteractionHelper) {
if (cookieBlocked == 1) {
is(oldState & options.expectedBlockingNotifications, 0,
"When blocking the first cookie, old state should not have had " +
"one of the blocking flag bit");
}
for (let trackerOrigin in contentBlockingLog) {
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
let originLog = contentBlockingLog[trackerOrigin];
if (options.expectedBlockingNotifications != Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_BY_PERMISSION)
ok(originLog.length > 1, "We should have at least two items in the log");
for (let i = 0; i < originLog.length; ++i) {
let item = originLog[i];
switch (item[0]) {
case Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT:
is(item[1], true, "Correct blocking status reported");
is(item[2], 1, "Correct repeat count reported");
break;
case Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT:
if (item[1]) {
ok(item[2] >= 1, "Correct repeat count reported");
} else {
// This branch is needed here because of the tests that use the storage
// access API to gain storage access.
is(item[2], 1, "Correct repeat count reported");
}
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER:
if (item[1]) {
ok(item[2] >= 1, "Correct repeat count reported");
} else {
// This branch is needed here because of the tests that use the storage
// access API to gain storage access.
is(item[2], 1, "Correct repeat count reported");
}
break;
}
}
}
// Can't assert the number of tracker origins because we may get 0
// for web progress navigations coming from the window opening from
// storage access API tracker interaction attempts...
}
if (!options.expectedBlockingNotifications) {
is(oldState & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, 0,
"When not blocking, old state should not have had the " +
"STATE_COOKIES_BLOCKED_TRACKER bit");
// Ensure that if there is something in the content blocking log, it's only
// STATE_LOADED_TRACKING_CONTENT notifications.
for (let trackerOrigin in contentBlockingLog) {
let originLog = contentBlockingLog[trackerOrigin];
for (let i = 0; i < originLog.length; ++i) {
let item = originLog[i];
switch (item[0]) {
case Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT:
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_LOADED:
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
}
}
}
}
}, },
}; };
win.gBrowser.addProgressListener(listener); win.gBrowser.addProgressListener(listener);
@ -552,58 +467,6 @@ this.AntiTracking = {
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, extraPrefs); await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, extraPrefs);
let cookieBlocked = 0;
let listener = {
onSecurityChange(webProgress, request, oldState, state,
contentBlockingLogJSON) {
if (state & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER) {
++cookieBlocked;
}
let contentBlockingLog = {};
try {
contentBlockingLog = JSON.parse(contentBlockingLogJSON);
} catch (e) {
}
if (cookieBlocked) {
for (let trackerOrigin in contentBlockingLog) {
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
let originLog = contentBlockingLog[trackerOrigin];
ok(originLog.length >= 1, "We should have at least two items in the log");
for (let i = 0; i < originLog.length; ++i) {
let item = originLog[i];
switch (item[0]) {
case Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT:
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
case Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT:
if (item[1]) {
ok(item[2] >= 1, "Correct repeat count reported");
} else {
is(item[2], 1, "Correct repeat count reported");
}
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER:
if (item[1]) {
ok(item[2] >= 1, "Correct repeat count reported");
} else {
is(item[2], 1, "Correct repeat count reported");
}
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_LOADED:
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
}
}
}
// Can't assert the number of tracker origins because we may get 0
// for web progress navigations coming from the window opening...
}
},
};
win.gBrowser.addProgressListener(listener);
info("Creating a new tab"); info("Creating a new tab");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE); let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
win.gBrowser.selectedTab = tab; win.gBrowser.selectedTab = tab;
@ -659,8 +522,6 @@ this.AntiTracking = {
}); });
}); });
win.gBrowser.removeProgressListener(listener);
info("Removing the tab"); info("Removing the tab");
BrowserTestUtils.removeTab(tab); BrowserTestUtils.removeTab(tab);
@ -671,8 +532,7 @@ this.AntiTracking = {
}, },
_createUserInteractionTask(name, blockingCallback, nonBlockingCallback, _createUserInteractionTask(name, blockingCallback, nonBlockingCallback,
runInPrivateWindow, iframeSandbox, runInPrivateWindow, iframeSandbox, extraPrefs) {
expectedBlockingNotifications, extraPrefs) {
add_task(async function() { add_task(async function() {
info("Starting user-interaction test " + name); info("Starting user-interaction test " + name);
@ -684,70 +544,6 @@ this.AntiTracking = {
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, extraPrefs); await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, extraPrefs);
let cookieBlocked = 0;
let listener = {
onSecurityChange(webProgress, request, oldState, state,
contentBlockingLogJSON) {
if (state & expectedBlockingNotifications) {
++cookieBlocked;
}
let contentBlockingLog = {};
try {
contentBlockingLog = JSON.parse(contentBlockingLogJSON);
} catch (e) {
}
// If this is the first cookie to be blocked, our state should have
// just changed, otherwise it should have previously contained one of
// the blocking flag bit too.
if (expectedBlockingNotifications && cookieBlocked) {
if (cookieBlocked == 1) {
is(oldState & expectedBlockingNotifications, 0,
"When blocking the first cookie, old state should not have had " +
"one of the blocking flag bit");
}
for (let trackerOrigin in contentBlockingLog) {
let originLog = contentBlockingLog[trackerOrigin];
ok(originLog.length >= 1, "We should have at least two items in the log");
for (let i = 0; i < originLog.length; ++i) {
let item = originLog[i];
switch (item[0]) {
case Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT:
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
case Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT:
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
if (item[1]) {
ok(item[2] >= 1, "Correct repeat count reported");
} else {
// This branch is needed here because of the tests that use the storage
// access API to gain storage access.
is(item[2], 1, "Correct repeat count reported");
}
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER:
is(trackerOrigin, TEST_3RD_PARTY_DOMAIN, "Correct tracker origin must be reported");
// We can expect 1 or more repeat count whether or not blocking has happened,
// so nothing to assert on item[1].
ok(item[2] >= 1, "Correct repeat count reported");
break;
case Ci.nsIWebProgressListener.STATE_COOKIES_LOADED:
// The trackerOrigin here is sometimes TEST_DOMAIN, sometimes TEST_3RD_PARTY_DOMAIN.
is(item[1], true, "Correct blocking status reported");
ok(item[2] >= 1, "Correct repeat count reported");
break;
}
}
}
// Can't assert the number of tracker origins because we may get 0
// for web progress navigations coming from the window opening...
}
},
};
win.gBrowser.addProgressListener(listener);
info("Creating a new tab"); info("Creating a new tab");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE); let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
win.gBrowser.selectedTab = tab; win.gBrowser.selectedTab = tab;
@ -895,8 +691,6 @@ this.AntiTracking = {
}); });
}); });
win.gBrowser.removeProgressListener(listener);
info("Removing the tab"); info("Removing the tab");
BrowserTestUtils.removeTab(tab); BrowserTestUtils.removeTab(tab);

View file

@ -711,12 +711,9 @@ nsWebBrowser::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
NS_IMETHODIMP NS_IMETHODIMP
nsWebBrowser::OnSecurityChange(nsIWebProgress* aWebProgress, nsWebBrowser::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t aState) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
if (mProgressListener) { if (mProgressListener) {
return mProgressListener->OnSecurityChange( return mProgressListener->OnSecurityChange(aWebProgress, aRequest, aState);
aWebProgress, aRequest, aOldState, aState, aContentBlockingLogJSON);
} }
return NS_OK; return NS_OK;
} }

View file

@ -59,8 +59,7 @@ var progressListener = {
}, },
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {}, onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {},
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, state) {},
aContentBlockingLogJSON) {},
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) { onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
if (aMessage) if (aMessage)

View file

@ -140,8 +140,7 @@ var progressListener = {
dialog.title.setAttribute("value", aMessage); dialog.title.setAttribute("value", aMessage);
}, },
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, state) {
aContentBlockingLogJSON) {
// we can ignore this notification // we can ignore this notification
}, },

View file

@ -82,9 +82,9 @@ PrintProgressDialogChild::OnStatusChange(nsIWebProgress* aProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
PrintProgressDialogChild::OnSecurityChange( PrintProgressDialogChild::OnSecurityChange(nsIWebProgress* aProgress,
nsIWebProgress* aProgress, nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest,
uint32_t aState, const nsAString& aContentBlockingLogJSON) { uint32_t aState) {
return NS_OK; return NS_OK;
} }

View file

@ -243,9 +243,9 @@ NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsPrintProgress::OnSecurityChange( NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aOldState, nsIRequest *aRequest,
uint32_t aState, const nsAString &aContentBlockingLogJSON) { uint32_t state) {
return NS_OK; return NS_OK;
} }

View file

@ -203,13 +203,13 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress* aWebProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsPrintingPromptService::OnSecurityChange( nsPrintingPromptService::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest,
uint32_t aState, const nsAString& aContentBlockingLogJSON) { uint32_t state) {
#if !defined(XP_MACOSX) #if !defined(XP_MACOSX)
if (mWebProgressListener) { if (mWebProgressListener) {
return mWebProgressListener->OnSecurityChange( return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest,
aWebProgress, aRequest, aOldState, aState, aContentBlockingLogJSON); state);
} }
#endif #endif
return NS_OK; return NS_OK;

View file

@ -234,13 +234,11 @@ nsBrowserStatusFilter::OnStatusChange(nsIWebProgress *aWebProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBrowserStatusFilter::OnSecurityChange( nsBrowserStatusFilter::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aOldState, nsIRequest *aRequest, uint32_t aState) {
uint32_t aState, const nsAString &aContentBlockingLogJSON) {
if (!mListener) return NS_OK; if (!mListener) return NS_OK;
return mListener->OnSecurityChange(aWebProgress, aRequest, aOldState, aState, return mListener->OnSecurityChange(aWebProgress, aRequest, aState);
aContentBlockingLogJSON);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -194,8 +194,7 @@ function testOnWindow(aTestData) {
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
let wp = win.gBrowser.contentWindow.docShell.QueryInterface(Ci.nsIWebProgress); let wp = win.gBrowser.contentWindow.docShell.QueryInterface(Ci.nsIWebProgress);
let progressListener = { let progressListener = {
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
expected = aTestData.reportUrl; expected = aTestData.reportUrl;
}, },
QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]), QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),

View file

@ -1,61 +1,61 @@
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
title = About Networking title = About Networking
warning = This is very experimental. Do not use without adult supervision. warning = This is very experimental. Do not use without adult supervision.
show-next-time-checkbox = Show this warning next time show-next-time-checkbox = Show this warning next time
ok = OK ok = OK
http = HTTP http = HTTP
sockets = Sockets sockets = Sockets
dns = DNS dns = DNS
websockets = WebSockets websockets = WebSockets
refresh = Refresh refresh = Refresh
auto-refresh = Autorefresh every 3 seconds auto-refresh = Autorefresh every 3 seconds
hostname = Hostname hostname = Hostname
port = Port port = Port
http2 = HTTP/2 http2 = HTTP/2
ssl = SSL ssl = SSL
active = Active active = Active
idle = Idle idle = Idle
host = Host host = Host
tcp = TCP tcp = TCP
sent = Sent sent = Sent
received = Received received = Received
family = Family family = Family
trr = TRR trr = TRR
addresses = Addresses addresses = Addresses
expires = Expires (Seconds) expires = Expires (Seconds)
messages-sent = Messages Sent messages-sent = Messages Sent
messages-received = Messages Received messages-received = Messages Received
bytes-sent = Bytes Sent bytes-sent = Bytes Sent
bytes-received = Bytes Received bytes-received = Bytes Received
logging = Logging logging = Logging
log-tutorial = log-tutorial =
See <a data-l10n-name="logging">HTTP Logging</a> See <a data-l10n-name="logging">HTTP Logging</a>
for instructions on how to use this tool. for instructions on how to use this tool.
current-log-file = Current Log File: current-log-file = Current Log File:
current-log-modules = Current Log Modules: current-log-modules = Current Log Modules:
set-log-file = Set Log File set-log-file = Set Log File
set-log-modules = Set Log Modules set-log-modules = Set Log Modules
start-logging = Start Logging start-logging = Start Logging
stop-logging = Stop Logging stop-logging = Stop Logging
dns-lookup = DNS Lookup dns-lookup = DNS Lookup
dns-lookup-button = Resolve dns-lookup-button = Resolve
dns-domain = Domain: dns-domain = Domain:
dns-lookup-table-column = IPs dns-lookup-table-column = IPs
rcwn = RCWN Stats rcwn = RCWN Stats
rcwn-status = RCWN Status rcwn-status = RCWN Status
rcwn-cache-won-count = Cache won count rcwn-cache-won-count = Cache won count
rcwn-net-won-count = Net won count rcwn-net-won-count = Net won count
total-network-requests = Total network request count total-network-requests = Total network request count
rcwn-operation = Cache Operation rcwn-operation = Cache Operation
rcwn-perf-open = Open rcwn-perf-open = Open
rcwn-perf-read = Read rcwn-perf-read = Read
rcwn-perf-write = Write rcwn-perf-write = Write
rcwn-perf-entry-open = Entry Open rcwn-perf-entry-open = Entry Open
rcwn-avg-short = Short Average rcwn-avg-short = Short Average
rcwn-avg-long = Long Average rcwn-avg-long = Long Average
rcwn-std-dev-long = Long Standard Deviation rcwn-std-dev-long = Long Standard Deviation
rcwn-cache-slow = Cache slow count rcwn-cache-slow = Cache slow count
rcwn-cache-not-slow = Cache not slow count rcwn-cache-not-slow = Cache not slow count

View file

@ -7,25 +7,19 @@ var EXPORTED_SYMBOLS = ["RemoteSecurityUI"];
function RemoteSecurityUI() { function RemoteSecurityUI() {
this._secInfo = null; this._secInfo = null;
this._oldState = 0;
this._state = 0; this._state = 0;
this._contentBlockingLogJSON = "";
} }
RemoteSecurityUI.prototype = { RemoteSecurityUI.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsISecureBrowserUI]), QueryInterface: ChromeUtils.generateQI([Ci.nsISecureBrowserUI]),
// nsISecureBrowserUI // nsISecureBrowserUI
get oldState() { return this._oldState; },
get state() { return this._state; }, get state() { return this._state; },
get contentBlockingLogJSON() { return this._contentBlockingLogJSON; },
get tooltipText() { return ""; }, get tooltipText() { return ""; },
get secInfo() { return this._secInfo; }, get secInfo() { return this._secInfo; },
_update(aSecInfo, aOldState, aState, aContentBlockingLogJSON) { _update(aSecInfo, aState) {
this._secInfo = aSecInfo; this._secInfo = aSecInfo;
this._oldState = aOldState;
this._state = aState; this._state = aState;
this._contentBlockingLogJSON = aContentBlockingLogJSON;
}, },
}; };

View file

@ -119,7 +119,7 @@ RemoteWebProgressManager.prototype = {
this._progressListeners.filter(l => l.listener != aListener); this._progressListeners.filter(l => l.listener != aListener);
}, },
_fixSecInfo(aSecInfo) { _fixSecInfoAndState(aSecInfo, aState) {
let deserialized = null; let deserialized = null;
if (aSecInfo) { if (aSecInfo) {
let helper = Cc["@mozilla.org/network/serialization-helper;1"] let helper = Cc["@mozilla.org/network/serialization-helper;1"]
@ -129,7 +129,7 @@ RemoteWebProgressManager.prototype = {
deserialized.QueryInterface(Ci.nsITransportSecurityInfo); deserialized.QueryInterface(Ci.nsITransportSecurityInfo);
} }
return deserialized; return [deserialized, aState];
}, },
setCurrentURI(aURI) { setCurrentURI(aURI) {
@ -244,23 +244,19 @@ RemoteWebProgressManager.prototype = {
break; break;
case "Content:SecurityChange": case "Content:SecurityChange":
let secInfo = this._fixSecInfo(json.secInfo); let [secInfo, state] = this._fixSecInfoAndState(json.secInfo, json.state);
let oldState = json.oldState;
let state = json.state;
let contentBlockingLogJSON = json.contentBlockingLogJSON;
if (isTopLevel) { if (isTopLevel) {
// Invoking this getter triggers the generation of the underlying object, // Invoking this getter triggers the generation of the underlying object,
// which we need to access with ._securityUI, because .securityUI returns // which we need to access with ._securityUI, because .securityUI returns
// a wrapper that makes _update inaccessible. // a wrapper that makes _update inaccessible.
void this._browser.securityUI; void this._browser.securityUI;
this._browser._securityUI._update(secInfo, oldState, state, this._browser._securityUI._update(secInfo, state);
contentBlockingLogJSON);
} }
this._callProgressListeners( this._callProgressListeners(
Ci.nsIWebProgress.NOTIFY_SECURITY, "onSecurityChange", webProgress, Ci.nsIWebProgress.NOTIFY_SECURITY, "onSecurityChange", webProgress,
request, oldState, state, contentBlockingLogJSON request, state
); );
break; break;

View file

@ -188,14 +188,11 @@ class WebProgressChild {
return null; return null;
} }
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
let json = this._setupJSON(aWebProgress, aRequest); let json = this._setupJSON(aWebProgress, aRequest);
json.oldState = aOldState;
json.state = aState; json.state = aState;
json.secInfo = this.getSecInfoAsString(); json.secInfo = this.getSecInfoAsString();
json.contentBlockingLogJSON = aContentBlockingLogJSON;
json.matchedList = null; json.matchedList = null;
if (aRequest && aRequest instanceof Ci.nsIClassifiedChannel) { if (aRequest && aRequest instanceof Ci.nsIClassifiedChannel) {

View file

@ -70,8 +70,7 @@ nsUnknownContentTypeDialogProgressListener.prototype = {
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) { onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
}, },
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, state) {
aContentBlockingLogJSON) {
}, },
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) { onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {

View file

@ -2186,8 +2186,7 @@ var gDiscoverView = {
aRequest.cancel(Cr.NS_BINDING_ABORTED); aRequest.cancel(Cr.NS_BINDING_ABORTED);
}, },
onSecurityChange(aWebProgress, aRequest, aOldState, aState, onSecurityChange(aWebProgress, aRequest, aState) {
aContentBlockingLogJSON) {
// Don't care about security if the page is not https // Don't care about security if the page is not https
if (!this.homepageURL.schemeIs("https")) if (!this.homepageURL.schemeIs("https"))
return; return;

View file

@ -40,7 +40,6 @@
using mozilla::DebugOnly; using mozilla::DebugOnly;
using mozilla::LogLevel; using mozilla::LogLevel;
using mozilla::dom::ContentBlockingLog;
// //
// Log module for nsIDocumentLoader logging... // Log module for nsIDocumentLoader logging...
@ -1394,25 +1393,21 @@ NS_IMETHODIMP nsDocLoader::AsyncOnChannelRedirect(
* Implementation of nsISecurityEventSink method... * Implementation of nsISecurityEventSink method...
*/ */
NS_IMETHODIMP nsDocLoader::OnSecurityChange( NS_IMETHODIMP nsDocLoader::OnSecurityChange(nsISupports* aContext,
nsISupports* aContext, uint32_t aOldState, uint32_t aState, uint32_t aState) {
ContentBlockingLog* aContentBlockingLog) {
// //
// Fire progress notifications out to any registered nsIWebProgressListeners. // Fire progress notifications out to any registered nsIWebProgressListeners.
// //
nsCOMPtr<nsIRequest> request = do_QueryInterface(aContext); nsCOMPtr<nsIRequest> request = do_QueryInterface(aContext);
nsIWebProgress* webProgress = static_cast<nsIWebProgress*>(this); nsIWebProgress* webProgress = static_cast<nsIWebProgress*>(this);
nsAutoString contentBlockingLogJSON(
aContentBlockingLog ? aContentBlockingLog->Stringify() : EmptyString());
NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_SECURITY, NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_SECURITY,
listener->OnSecurityChange(webProgress, request, aOldState, listener->OnSecurityChange(webProgress, request, aState););
aState, contentBlockingLogJSON););
// Pass the notification up to the parent... // Pass the notification up to the parent...
if (mParent) { if (mParent) {
mParent->OnSecurityChange(aContext, aOldState, aState, aContentBlockingLog); mParent->OnSecurityChange(aContext, aState);
} }
return NS_OK; return NS_OK;
} }

View file

@ -471,32 +471,15 @@ interface nsIWebProgressListener : nsISupports
* The nsIWebProgress instance that fired the notification. * The nsIWebProgress instance that fired the notification.
* @param aRequest * @param aRequest
* The nsIRequest that has new security state. * The nsIRequest that has new security state.
* @param aOldState
* A value composed of the Security State Flags and the Security
* Strength Flags listed above. Any undefined bits are reserved for
* future use. This represents the security state before the change.
* @param aState * @param aState
* A value composed of the Security State Flags and the Security * A value composed of the Security State Flags and the Security
* Strength Flags listed above. Any undefined bits are reserved for * Strength Flags listed above. Any undefined bits are reserved for
* future use. This represents the security state after the change. * future use.
* @param aContentBlockingLog
* An optional JSON string representing a log of the content blocking
* events happened so far. This will be a JSON object containing keys
* representing origins that content blocking has acted on, with values
* being an array of items, each representing one action. Each action
* itself is an an array containing three elements, the first element
* being a blocking code from one of the Security State Flags above, and
* the second element being a boolean representing whether the origin
* was blocked (if true) or unblocked (if false) in that category, and
* the third element being the number of times that combination has been
* repeated consecutively.
* *
* NOTE: These notifications will only occur if a security package is * NOTE: These notifications will only occur if a security package is
* installed. * installed.
*/ */
void onSecurityChange(in nsIWebProgress aWebProgress, void onSecurityChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest, in nsIRequest aRequest,
in unsigned long aOldState, in unsigned long aState);
in unsigned long aState,
in AString aContentBlockingLogJSON);
}; };

View file

@ -212,9 +212,9 @@ nsOfflineCachePendingUpdate::OnStatusChange(nsIWebProgress *aWebProgress,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsOfflineCachePendingUpdate::OnSecurityChange( nsOfflineCachePendingUpdate::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aOldState, nsIRequest *aRequest,
uint32_t aState, const nsAString &aContentBlockingLogJSON) { uint32_t state) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -919,9 +919,7 @@ nsPrefetchService::OnStatusChange(nsIWebProgress *aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
nsPrefetchService::OnSecurityChange(nsIWebProgress *aWebProgress, nsPrefetchService::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest, uint32_t aOldState, nsIRequest *aRequest, uint32_t state) {
uint32_t aState,
const nsAString &aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }

View file

@ -168,7 +168,8 @@ NonBlockingAsyncInputStream::Close() {
NS_IMETHODIMP NS_IMETHODIMP
NonBlockingAsyncInputStream::Available(uint64_t* aLength) { NonBlockingAsyncInputStream::Available(uint64_t* aLength) {
nsresult rv = mInputStream->Available(aLength); nsresult rv = mInputStream->Available(aLength);
if (NS_WARN_IF(NS_FAILED(rv))) { // Don't issue warnings for legal condition NS_BASE_STREAM_CLOSED.
if (rv == NS_BASE_STREAM_CLOSED || NS_WARN_IF(NS_FAILED(rv))) {
return rv; return rv;
} }

View file

@ -445,9 +445,7 @@ nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
nsChromeTreeOwner::OnSecurityChange(nsIWebProgress* aWebProgress, nsChromeTreeOwner::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t state) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
return NS_OK; return NS_OK;
} }

View file

@ -629,9 +629,7 @@ nsWebShellWindow::OnStatusChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
nsWebShellWindow::OnSecurityChange(nsIWebProgress* aWebProgress, nsWebShellWindow::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, uint32_t aOldState, nsIRequest* aRequest, uint32_t state) {
uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;
} }