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
DocManager::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
uint32_t aOldState, uint32_t aState,
const nsAString& aContentBlockingLogJSON) {
uint32_t aState) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}

View file

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

View file

@ -4927,8 +4927,7 @@ var XULBrowserWindow = {
// 3. Called directly during this object's initializations.
// 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).
onSecurityChange(aWebProgress, aRequest, aOldState, aState,
aContentBlockingLogJSON, aIsSimulated) {
onSecurityChange(aWebProgress, aRequest, aState, aIsSimulated) {
// Don't need to do anything if the data we use to update the UI hasn't
// changed
let uri = gBrowser.currentURI;
@ -4955,8 +4954,7 @@ var XULBrowserWindow = {
uri = Services.uriFixup.createExposableURI(uri);
} catch (e) {}
gIdentityHandler.updateIdentity(this._state, uri);
ContentBlocking.onSecurityChange(aOldState, this._state, aWebProgress, aIsSimulated,
aContentBlockingLogJSON);
ContentBlocking.onSecurityChange(this._state, aWebProgress, aIsSimulated);
},
// simulate all change notifications after switching tabs

View file

@ -962,13 +962,8 @@ window._gBrowser = {
if (securityUI) {
// Include the true final argument to indicate that this event is
// 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",
[webProgress, null, oldState, state,
securityUI.contentBlockingLogJSON, true],
[webProgress, null, securityUI.state, true],
true, false);
}
@ -1713,17 +1708,12 @@ window._gBrowser = {
// Restore the securityUI state.
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 :
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
// simulated (instead of being observed by the webProgressListener).
this._callProgressListeners(aBrowser, "onSecurityChange",
[aBrowser.webProgress, null, oldState, state,
securityUI.contentBlockingLogJSON, true],
[aBrowser.webProgress, null, state, true],
true, false);
if (aShouldBeRemote) {
@ -5206,10 +5196,9 @@ class TabProgressListener {
this.mMessage = aMessage;
}
onSecurityChange(aWebProgress, aRequest, aOldState, aState, aContentBlockingLogJSON) {
onSecurityChange(aWebProgress, aRequest, aState) {
this._callProgressListeners("onSecurityChange",
[aWebProgress, aRequest, aOldState, aState,
aContentBlockingLogJSON]);
[aWebProgress, aRequest, aState]);
}
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -253,8 +253,7 @@ class GeckoViewProgress extends GeckoViewModule {
}
}
onSecurityChange(aWebProgress, aRequest, aOldState, aState,
aContentBlockingLogJSON) {
onSecurityChange(aWebProgress, aRequest, aState) {
debug `onSecurityChange`;
// 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);
}
onSecurityChange(aWebProgress, aRequest, aOldState, aState,
aContentBlockingLogJSON) {
onSecurityChange(aWebProgress, aRequest, aState) {
debug `onSecurityChange`;
if (!(aState & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) ||

View file

@ -14,32 +14,7 @@ interface nsISecureBrowserUI : nsISupports
{
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;
// 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;
};

View file

@ -4,16 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{ C++
namespace mozilla {
namespace dom {
class ContentBlockingLog;
}
}
%}
[ptr] native ContentBlockingLog(mozilla::dom::ContentBlockingLog);
interface nsIURI;
[builtinclass, uuid(a71aee68-dd38-4736-bd79-035fea1a1ec6)]
interface nsISecurityEventSink : nsISupports
@ -25,13 +16,9 @@ interface nsISecurityEventSink : nsISupports
* a security package (eg Netscape Personal Security Manager)
* to notify nsIWebProgressListeners that security state has
* 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,
in unsigned long state, in ContentBlockingLog cbLog);
void onSecurityChange(in nsISupports i_Context, in unsigned long state);
};

View file

@ -21,7 +21,7 @@ using namespace mozilla;
LazyLogModule gSecureBrowserUILog("nsSecureBrowserUI");
nsSecureBrowserUIImpl::nsSecureBrowserUIImpl() : mOldState(0), mState(0) {
nsSecureBrowserUIImpl::nsSecureBrowserUIImpl() : mState(0) {
MOZ_ASSERT(NS_IsMainThread());
}
@ -57,19 +57,6 @@ nsSecureBrowserUIImpl::Init(nsIDocShell* aDocShell) {
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
nsSecureBrowserUIImpl::GetState(uint32_t* aState) {
MOZ_ASSERT(NS_IsMainThread());
@ -86,28 +73,6 @@ nsSecureBrowserUIImpl::GetState(uint32_t* aState) {
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
nsSecureBrowserUIImpl::GetSecInfo(nsITransportSecurityInfo** result) {
MOZ_ASSERT(NS_IsMainThread());
@ -142,8 +107,6 @@ void nsSecureBrowserUIImpl::CheckForBlockedContent() {
}
}
mOldState = mState;
// Has mixed content been loaded or blocked in nsMixedContentBlocker?
// 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
@ -388,7 +351,6 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
return NS_OK;
}
mOldState = 0;
mState = 0;
mTopLevelSecurityInfo = nullptr;
@ -415,21 +377,12 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress,
}
}
mozilla::dom::ContentBlockingLog* contentBlockingLog = nullptr;
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocShell);
if (docShell) {
nsIDocument* doc = docShell->GetDocument();
if (doc) {
contentBlockingLog = doc->GetContentBlockingLog();
}
}
nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell);
if (eventSink) {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" calling OnSecurityChange %p %x", aRequest, mState));
Unused << eventSink->OnSecurityChange(aRequest, mOldState, mState,
contentBlockingLog);
Unused << eventSink->OnSecurityChange(aRequest, mState);
} else {
MOZ_LOG(gSecureBrowserUILog, LogLevel::Debug,
(" no docShell or couldn't QI it to nsISecurityEventSink?"));
@ -460,8 +413,7 @@ nsSecureBrowserUIImpl::OnStatusChange(nsIWebProgress*, nsIRequest*, nsresult,
}
nsresult nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress*, nsIRequest*,
uint32_t, uint32_t,
const nsAString&) {
uint32_t) {
MOZ_ASSERT_UNREACHABLE("Should have been excluded in AddProgressListener()");
return NS_OK;
}

View file

@ -34,14 +34,12 @@ class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
protected:
virtual ~nsSecureBrowserUIImpl(){};
// Do mixed content and tracking protection checks. May update mState and
// mOldState.
// Do mixed content and tracking protection checks. May update mState.
void CheckForBlockedContent();
// 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);
uint32_t mOldState;
uint32_t mState;
nsWeakPtr mDocShell;
nsWeakPtr mWebProgress;

View file

@ -80,26 +80,31 @@ class AwsyTestCase(MarionetteTestCase):
def tearDown(self):
MarionetteTestCase.tearDown(self)
self.logger.info("processing data in %s!" % self._resultsDir)
perf_blob = process_perf_data.create_perf_data(
self._resultsDir, self.perf_suites(),
self.perf_checkpoints())
self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob))
try:
self.logger.info("processing data in %s!" % self._resultsDir)
perf_blob = process_perf_data.create_perf_data(
self._resultsDir, self.perf_suites(),
self.perf_checkpoints())
self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob))
perf_file = os.path.join(self._resultsDir, "perfherder_data.json")
with open(perf_file, 'w') as fp:
json.dump(perf_blob, fp, indent=2)
self.logger.info("Perfherder data written to %s" % perf_file)
perf_file = os.path.join(self._resultsDir, "perfherder_data.json")
with open(perf_file, 'w') as fp:
json.dump(perf_blob, fp, indent=2)
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:
self.cleanup_dmd()
# copy it to moz upload dir if set
if 'MOZ_UPLOAD_DIR' in os.environ:
for file in os.listdir(self._resultsDir):
file = os.path.join(self._resultsDir, file)
if os.path.isfile(file):
shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
# copy it to moz upload dir if set
if 'MOZ_UPLOAD_DIR' in os.environ:
for file in os.listdir(self._resultsDir):
file = os.path.join(self._resultsDir, file)
if os.path.isfile(file):
shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
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) {},
onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange(aWebProgress, aRequest, aOldState, aState,
aContentBlockingLogJSON) {},
onSecurityChange(aWebProgress, aRequest, aState) {},
};

View file

@ -17,7 +17,7 @@ async function onModifyRequest() {
let httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
let spec = httpChannel.URI.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;
}
if (spec.endsWith("empty.js")) {

View file

@ -185,7 +185,7 @@ add_task(async function() {
let log = JSON.parse(await browser.getContentBlockingLog());
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];
is(originLog.length, 4, "We should have 4 entries in the compressed log");
expectTrackerFound(originLog[0]);

View file

@ -1,15 +1,15 @@
const TEST_DOMAIN = "http://example.net";
const TEST_DOMAIN_2 = "http://xn--exmple-cua.test";
const TEST_DOMAIN_3 = "https://xn--hxajbheg2az3al.xn--jxalpdlp";
const TEST_DOMAIN_4 = "http://prefixexample.com";
const TEST_DOMAIN_5 = "http://test";
const TEST_DOMAIN_6 = "http://mochi.test:8888";
const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org";
const TEST_3RD_PARTY_DOMAIN_TP = "https://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_DOMAIN = "http://example.net/";
const TEST_DOMAIN_2 = "http://xn--exmple-cua.test/";
const TEST_DOMAIN_3 = "https://xn--hxajbheg2az3al.xn--jxalpdlp/";
const TEST_DOMAIN_4 = "http://prefixexample.com/";
const TEST_DOMAIN_5 = "http://test/";
const TEST_DOMAIN_6 = "http://mochi.test:8888/";
const TEST_3RD_PARTY_DOMAIN = "https://tracking.example.org/";
const TEST_3RD_PARTY_DOMAIN_TP = "https://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_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_2 = TEST_DOMAIN_2 + TEST_PATH + "page.html";
@ -35,7 +35,7 @@ var gFeatures = undefined;
let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
requestLongerTimeout(5);
requestLongerTimeout(3);
this.AntiTracking = {
runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs,
@ -230,8 +230,7 @@ this.AntiTracking = {
// get blocked with user interaction present
if (userInteractionTest) {
this._createUserInteractionTask(name, callbackTracking, callbackNonTracking,
runInPrivateWindow, iframeSandbox,
expectedBlockingNotifications, extraPrefs);
runInPrivateWindow, iframeSandbox, extraPrefs);
this._createCleanupTask(cleanupFunction);
}
}
@ -300,94 +299,10 @@ this.AntiTracking = {
let cookieBlocked = 0;
let listener = {
onSecurityChange(webProgress, request, oldState, state,
contentBlockingLogJSON) {
onSecurityChange(webProgress, request, state) {
if ((state & options.expectedBlockingNotifications)) {
++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);
@ -552,58 +467,6 @@ this.AntiTracking = {
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");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
win.gBrowser.selectedTab = tab;
@ -659,8 +522,6 @@ this.AntiTracking = {
});
});
win.gBrowser.removeProgressListener(listener);
info("Removing the tab");
BrowserTestUtils.removeTab(tab);
@ -671,8 +532,7 @@ this.AntiTracking = {
},
_createUserInteractionTask(name, blockingCallback, nonBlockingCallback,
runInPrivateWindow, iframeSandbox,
expectedBlockingNotifications, extraPrefs) {
runInPrivateWindow, iframeSandbox, extraPrefs) {
add_task(async function() {
info("Starting user-interaction test " + name);
@ -684,70 +544,6 @@ this.AntiTracking = {
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");
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
win.gBrowser.selectedTab = tab;
@ -895,8 +691,6 @@ this.AntiTracking = {
});
});
win.gBrowser.removeProgressListener(listener);
info("Removing the tab");
BrowserTestUtils.removeTab(tab);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -471,32 +471,15 @@ interface nsIWebProgressListener : nsISupports
* The nsIWebProgress instance that fired the notification.
* @param aRequest
* 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
* 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 after the change.
* @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.
* future use.
*
* NOTE: These notifications will only occur if a security package is
* installed.
*/
void onSecurityChange(in nsIWebProgress aWebProgress,
in nsIRequest aRequest,
in unsigned long aOldState,
in unsigned long aState,
in AString aContentBlockingLogJSON);
in unsigned long aState);
};

View file

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

View file

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

View file

@ -168,7 +168,8 @@ NonBlockingAsyncInputStream::Close() {
NS_IMETHODIMP
NonBlockingAsyncInputStream::Available(uint64_t* 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;
}

View file

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

View file

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