author | Jet Villegas <bugs@junglecode.net> |
Mon, 06 Feb 2017 16:40:00 -0500 | |
changeset 341252 | 4fd8f1f47a325cdecf98dcde43574f6a11a8768c |
parent 341251 | 0d82d5182d7c025c090523297b93cc368051ff77 |
child 341253 | 13048a5b9d7a764307cb021b3aa2cd5a03368b19 |
push id | 86669 |
push user | ryanvm@gmail.com |
push date | Wed, 08 Feb 2017 01:38:21 +0000 |
treeherder | mozilla-inbound@13048a5b9d7a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | tobytailor |
bugs | 1311368 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/base/nsObjectLoadingContent.cpp | file | annotate | diff | comparison | revisions | |
dom/base/nsObjectLoadingContent.h | file | annotate | diff | comparison | revisions |
--- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -658,17 +658,17 @@ nsObjectLoadingContent::nsObjectLoadingC : mType(eType_Loading) , mFallbackType(eFallbackAlternate) , mRunID(0) , mHasRunID(false) , mChannelLoaded(false) , mInstantiating(false) , mNetworkCreated(true) , mActivated(false) - , mContentBlockingDisabled(false) + , mContentBlockingEnabled(false) , mIsStopping(false) , mIsLoading(false) , mScriptRequested(false) , mRewrittenYoutubeEmbed(false) , mPreferFallback(false) , mPreferFallbackKnown(false) {} nsObjectLoadingContent::~nsObjectLoadingContent() @@ -1053,36 +1053,36 @@ nsObjectLoadingContent::OnStartRequest(n NS_ASSERTION(!mChannelLoaded, "mChannelLoaded set already?"); NS_ASSERTION(!mFinalListener, "mFinalListener exists already?"); mChannelLoaded = true; nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest)); NS_ASSERTION(chan, "Why is our request not a channel?"); - nsresult status; + nsresult status = NS_OK; bool success = IsSuccessfulRequest(aRequest, &status); if (status == NS_ERROR_BLOCKED_URI) { nsCOMPtr<nsIConsoleService> console( do_GetService("@mozilla.org/consoleservice;1")); if (console) { nsCOMPtr<nsIURI> uri; chan->GetURI(getter_AddRefs(uri)); nsString message = NS_LITERAL_STRING("Blocking ") + NS_ConvertASCIItoUTF16(uri->GetSpecOrDefault().get()) + NS_LITERAL_STRING(" since it was found on an internal Firefox blocklist."); console->LogStringMessage(message.get()); } Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1); + mContentBlockingEnabled = true; return NS_ERROR_FAILURE; } else if (status == NS_ERROR_TRACKING_URI) { + mContentBlockingEnabled = true; return NS_ERROR_FAILURE; - } else { - mContentBlockingDisabled = true; } if (!success) { LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this)); // If the request fails, we still call LoadObject() to handle fallback // content and notifying of failure. (mChannelLoaded && !mChannel) indicates // the bad state. mChannel = nullptr; @@ -3219,42 +3219,53 @@ nsObjectLoadingContent::GetRunID(SystemC return 0; } return mRunID; } static bool sPrefsInitialized; static uint32_t sSessionTimeoutMinutes; static uint32_t sPersistentTimeoutDays; +static bool sBlockURIs; + +static void initializeObjectLoadingContentPrefs() +{ + if (!sPrefsInitialized) { + Preferences::AddUintVarCache(&sSessionTimeoutMinutes, + "plugin.sessionPermissionNow.intervalInMinutes", 60); + Preferences::AddUintVarCache(&sPersistentTimeoutDays, + "plugin.persistentPermissionAlways.intervalInDays", 90); + + Preferences::AddBoolVarCache(&sBlockURIs, kPrefBlockURIs, false); + sPrefsInitialized = true; + } +} bool nsObjectLoadingContent::ShouldBlockContent() { - if (mContentBlockingDisabled || !mURI) - return false; - - if (!IsFlashMIME(mContentType) || !Preferences::GetBool(kPrefBlockURIs)) { - mContentBlockingDisabled = true; - return false; + + if (!sPrefsInitialized) { + initializeObjectLoadingContentPrefs(); } - return true; + if (mContentBlockingEnabled && mURI && IsFlashMIME(mContentType) && sBlockURIs ) { + return true; + } + + return false; } bool nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentType) { nsresult rv; if (!sPrefsInitialized) { - Preferences::AddUintVarCache(&sSessionTimeoutMinutes, - "plugin.sessionPermissionNow.intervalInMinutes", 60); - Preferences::AddUintVarCache(&sPersistentTimeoutDays, - "plugin.persistentPermissionAlways.intervalInDays", 90); - sPrefsInitialized = true; + initializeObjectLoadingContentPrefs(); } if (BrowserTabsRemoteAutostart()) { bool shouldLoadInParent = nsPluginHost::ShouldLoadTypeInParent(mContentType); bool inParent = XRE_IsParentProcess(); if (shouldLoadInParent != inParent) { // Plugins need to be locked to either the parent process or the content
--- a/dom/base/nsObjectLoadingContent.h +++ b/dom/base/nsObjectLoadingContent.h @@ -672,17 +672,17 @@ class nsObjectLoadingContent : public ns // it may lose the flag. bool mNetworkCreated : 1; // Used to keep track of whether or not a plugin has been explicitly // activated by PlayPlugin(). (see ShouldPlay()) bool mActivated : 1; // Whether content blocking is enabled or not for this object. - bool mContentBlockingDisabled : 1; + bool mContentBlockingEnabled : 1; // Protects DoStopPlugin from reentry (bug 724781). bool mIsStopping : 1; // Protects LoadObject from re-entry bool mIsLoading : 1; // For plugin stand-in types (click-to-play) tracks