Bug 1510911 - Part 2: Backout changeset f8849239da42 (bug 1493563 - Part 5) for regressing performance

This commit is contained in:
Ehsan Akhgari 2018-11-29 10:46:08 -05:00
Родитель 2f00a97c85
Коммит 0dcf936804
51 изменённых файлов: 77 добавлений и 231 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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

Просмотреть файл

@ -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");

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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)
{
},

Просмотреть файл

@ -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)
{
},

Просмотреть файл

@ -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)
{
},

Просмотреть файл

@ -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)
{
},

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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) ||

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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());
@ -460,8 +425,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;
}

Просмотреть файл

@ -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) {},
};

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -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
},

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);
}
//-----------------------------------------------------------------------------

Просмотреть файл

@ -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"]),

Просмотреть файл

@ -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;
},
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -1403,12 +1403,9 @@ NS_IMETHODIMP nsDocLoader::OnSecurityChange(
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) {

Просмотреть файл

@ -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);
};

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}