Bug 1517136 - Devirtualize and inline the calls in nsSecureBrowserUIImpl::CheckForBlockedContent(); r=baku

Differential Revision: https://phabricator.services.mozilla.com/D15574
This commit is contained in:
Ehsan Akhgari
2019-01-02 10:21:49 -05:00
parent 3dc20eca10
commit 124e361b1d
3 changed files with 17 additions and 107 deletions

View File

@@ -107,56 +107,62 @@ void nsSecureBrowserUIImpl::CheckForBlockedContent() {
}
}
nsCOMPtr<nsIDocument> doc = docShell->GetDocument();
if (!doc) {
// If the docshell has no document, then there is no need to update mState.
return;
}
// 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
// than STATE_IS_SECURE.
if (((mState & STATE_IS_SECURE) != 0) || ((mState & STATE_IS_BROKEN) != 0)) {
if (docShell->GetHasMixedActiveContentLoaded()) {
if (doc->GetHasMixedActiveContentLoaded()) {
mState |= STATE_IS_BROKEN | STATE_LOADED_MIXED_ACTIVE_CONTENT;
mState &= ~STATE_IS_SECURE;
}
if (docShell->GetHasMixedDisplayContentLoaded()) {
if (doc->GetHasMixedDisplayContentLoaded()) {
mState |= STATE_IS_BROKEN | STATE_LOADED_MIXED_DISPLAY_CONTENT;
mState &= ~STATE_IS_SECURE;
}
if (docShell->GetHasMixedActiveContentBlocked()) {
if (doc->GetHasMixedActiveContentBlocked()) {
mState |= STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
}
if (docShell->GetHasMixedDisplayContentBlocked()) {
if (doc->GetHasMixedDisplayContentBlocked()) {
mState |= STATE_BLOCKED_MIXED_DISPLAY_CONTENT;
}
}
// Has tracking content been blocked or loaded?
if (docShell->GetHasTrackingContentBlocked()) {
if (doc->GetHasTrackingContentBlocked()) {
mState |= STATE_BLOCKED_TRACKING_CONTENT;
}
if (docShell->GetHasTrackingContentLoaded()) {
if (doc->GetHasTrackingContentLoaded()) {
mState |= STATE_LOADED_TRACKING_CONTENT;
}
if (docShell->GetHasCookiesBlockedByPermission()) {
if (doc->GetHasCookiesBlockedByPermission()) {
mState |= STATE_COOKIES_BLOCKED_BY_PERMISSION;
}
if (docShell->GetHasCookiesBlockedDueToTrackers()) {
if (doc->GetHasTrackingCookiesBlocked()) {
mState |= STATE_COOKIES_BLOCKED_TRACKER;
}
if (docShell->GetHasForeignCookiesBeenBlocked()) {
if (doc->GetHasForeignCookiesBlocked()) {
mState |= STATE_COOKIES_BLOCKED_FOREIGN;
}
if (docShell->GetHasAllCookiesBeenBlocked()) {
if (doc->GetHasAllCookiesBlocked()) {
mState |= STATE_COOKIES_BLOCKED_ALL;
}
if (docShell->GetHasCookiesLoaded()) {
if (doc->GetHasCookiesLoaded()) {
mState |= STATE_COOKIES_LOADED;
}
}