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

@@ -1378,59 +1378,6 @@ nsDocShell::GetHasMixedDisplayContentBlocked(
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentBlocked(bool* aHasTrackingContentBlocked) {
RefPtr<Document> doc(GetDocument());
*aHasTrackingContentBlocked = doc && doc->GetHasTrackingContentBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded) {
RefPtr<Document> doc(GetDocument());
*aHasTrackingContentLoaded = doc && doc->GetHasTrackingContentLoaded();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasCookiesBlockedByPermission(
bool* aHasCookiesBlockedByPermission) {
RefPtr<Document> doc(GetDocument());
*aHasCookiesBlockedByPermission =
doc && doc->GetHasCookiesBlockedByPermission();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasCookiesBlockedDueToTrackers(
bool* aHasCookiesBlockedDueToTrackers) {
RefPtr<Document> doc(GetDocument());
*aHasCookiesBlockedDueToTrackers = doc && doc->GetHasTrackingCookiesBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasAllCookiesBeenBlocked(bool* aHasAllCookiesBeenBlocked) {
RefPtr<Document> doc(GetDocument());
*aHasAllCookiesBeenBlocked = doc && doc->GetHasAllCookiesBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasForeignCookiesBeenBlocked(
bool* aHasForeignCookiesBeenBlocked) {
RefPtr<Document> doc(GetDocument());
*aHasForeignCookiesBeenBlocked = doc && doc->GetHasForeignCookiesBlocked();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetHasCookiesLoaded(bool* aHasCookiesLoaded) {
RefPtr<Document> doc(GetDocument());
*aHasCookiesLoaded = doc && doc->GetHasCookiesLoaded();
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetAllowPlugins(bool* aAllowPlugins) {
NS_ENSURE_ARG_POINTER(aAllowPlugins);

View File

@@ -499,49 +499,6 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[infallible] readonly attribute boolean hasMixedDisplayContentBlocked;
/**
* This attribute determines whether a document has Tracking Content
* that has been blocked from loading.
*/
[infallible] readonly attribute boolean hasTrackingContentBlocked;
/**
* This attribute determines whether Tracking Content is loaded on the
* document. When it is true, tracking content was not blocked and has
* loaded (or is about to load) on the page.
*/
[infallible] readonly attribute boolean hasTrackingContentLoaded;
/**
* This attribute determines whether a document seen cookies or storage
* blocked due to a site permission being denied.
*/
[infallible] readonly attribute boolean hasCookiesBlockedByPermission;
/**
* This attribute determines whether a document seen cookies or storage
* blocked due to a the request being made by a tracker.
*/
[infallible] readonly attribute boolean hasCookiesBlockedDueToTrackers;
/**
* This attribute determines whether a document seen cookies or storage
* blocked due to cookie behavior settings blocking all cookies.
*/
[infallible] readonly attribute boolean hasAllCookiesBeenBlocked;
/**
* This attribute determines whether a document seen cookies or storage
* blocked due to cookie behavior settings blocking all third-party cookies.
*/
[infallible] readonly attribute boolean hasForeignCookiesBeenBlocked;
/**
* This attribute determines whether a document seen cookies or storage
* attempts ever whether they've been allowed or blocked.
*/
[infallible] readonly attribute boolean hasCookiesLoaded;
/**
* Disconnects this docshell's editor from its window, and stores the
* editor data in the open document's session history entry. This

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