Bug 1584931 - P2. Disable flashblock when fission is enabled. r=bytesized
authorDimi Lee <dlee@mozilla.com>
Wed, 04 Dec 2019 09:00:28 +0000
changeset 505285 e33d5fb3f370647b0e5acd308d6dd6cd269bf136
parent 505284 7f7d7683109ab33dafe5f0891892582a1432e8bc
child 505286 808799f11727c9d66f4beeb9f876a40cdca1c83e
push id36881
push userdvarga@mozilla.com
push dateWed, 04 Dec 2019 16:22:31 +0000
treeherdermozilla-central@13fb375eaf14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1584931
milestone73.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
Bug 1584931 - P2. Disable flashblock when fission is enabled. r=bytesized This patch does the following: 1. Disable flashblock when fission is enabled. 2. Update flashblock tests to expect "unknown" classification when fission is enabled. 3. Remove skip-if=fission in flashblock mochitests. Depends on D51098 Differential Revision: https://phabricator.services.mozilla.com/D55091
dom/base/Document.cpp
netwerk/url-classifier/UrlClassifierFeatureFlash.cpp
toolkit/components/url-classifier/tests/browser/browser.ini
toolkit/components/url-classifier/tests/browser/classifierTester.js
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -15049,19 +15049,24 @@ void Document::TraceProtos(JSTracer* aTr
 }
 
 /**
  * Retrieves the classification of the Flash plugins in the document based on
  * the classification lists. For more information, see
  * toolkit/components/url-classifier/flash-block-lists.rst
  */
 FlashClassification Document::DocumentFlashClassification() {
+  // Disable flash blocking when fission is enabled(See Bug 1584931).
+  const auto fnIsFlashBlockingEnabled = [] {
+    return StaticPrefs::plugins_flashBlock_enabled() &&
+           !StaticPrefs::fission_autostart();
+  };
+
   // If neither pref is on, skip the null-principal and principal URI checks.
-  if (!StaticPrefs::plugins_http_https_only() &&
-      !StaticPrefs::plugins_flashBlock_enabled()) {
+  if (!StaticPrefs::plugins_http_https_only() && !fnIsFlashBlockingEnabled()) {
     return FlashClassification::Unknown;
   }
 
   if (!NodePrincipal()->GetIsContentPrincipal()) {
     return FlashClassification::Denied;
   }
 
   if (StaticPrefs::plugins_http_https_only()) {
@@ -15074,17 +15079,17 @@ FlashClassification Document::DocumentFl
     if (!(NodePrincipal()->SchemeIs("http") ||
           NodePrincipal()->SchemeIs("https"))) {
       return FlashClassification::Denied;
     }
   }
 
   // If flash blocking is disabled, it is equivalent to all sites being
   // on neither list.
-  if (!StaticPrefs::plugins_flashBlock_enabled()) {
+  if (!fnIsFlashBlockingEnabled()) {
     return FlashClassification::Unknown;
   }
 
   if (mFlashClassification == FlashClassification::Unknown) {
     mFlashClassification = DocumentFlashClassificationInternal();
   }
 
   return mFlashClassification;
--- a/netwerk/url-classifier/UrlClassifierFeatureFlash.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureFlash.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "UrlClassifierFeatureFlash.h"
 #include "mozilla/net/HttpBaseChannel.h"
+#include "mozilla/StaticPrefs_fission.h"
 #include "mozilla/StaticPrefs_plugins.h"
 #include "nsScriptSecurityManager.h"
 #include "nsQueryObject.h"
 
 namespace mozilla {
 namespace net {
 
 struct UrlClassifierFeatureFlash::FlashFeature {
@@ -91,18 +92,23 @@ void UrlClassifierFeatureFlash::MaybeShu
     flashFeature.mFeature = nullptr;
   }
 }
 
 /* static */
 void UrlClassifierFeatureFlash::MaybeCreate(
     nsIChannel* aChannel,
     nsTArray<nsCOMPtr<nsIUrlClassifierFeature>>& aFeatures) {
+  const auto fnIsFlashBlockingEnabled = [] {
+    return StaticPrefs::plugins_flashBlock_enabled() &&
+           !StaticPrefs::fission_autostart();
+  };
+
   // All disabled.
-  if (!StaticPrefs::plugins_flashBlock_enabled()) {
+  if (!fnIsFlashBlockingEnabled()) {
     return;
   }
 
   // We use Flash feature just for document loading.
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
   nsContentPolicyType contentPolicyType =
       loadInfo->GetExternalContentPolicyType();
 
--- a/toolkit/components/url-classifier/tests/browser/browser.ini
+++ b/toolkit/components/url-classifier/tests/browser/browser.ini
@@ -1,20 +1,13 @@
 [DEFAULT]
 support-files =
   flash_block_frame.html
   classifierHelper.js
   classifierTester.js
   simple_blank.swf
 
 [browser_flashblock_on_with_never_activate.js]
-skip-if = fission
 [browser_flashblock_off_with_never_activate.js]
-skip-if = fission
 [browser_flashblock_on_with_ask_to_activate.js]
-skip-if = fission
 [browser_flashblock_off_with_ask_to_activate.js]
-skip-if = fission
 [browser_flashblock_on_with_always_activate.js]
-skip-if = fission
 [browser_flashblock_off_with_always_activate.js]
-
-skip-if = fission
--- a/toolkit/components/url-classifier/tests/browser/classifierTester.js
+++ b/toolkit/components/url-classifier/tests/browser/classifierTester.js
@@ -5,16 +5,17 @@
 var classifierTester = {
   URL_PATH:
     "/browser/toolkit/components/url-classifier/tests/browser/flash_block_frame.html",
   OBJECT_ID: "testObject",
   IFRAME_ID: "testFrame",
   FLASHBLOCK_ENABLE_PREF: "plugins.flashBlock.enabled",
   FLASH_PLUGIN_USER_SETTING_PREF: "plugin.state.flash",
   URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF: "urlclassifier.disallow_completions",
+  FISSION_PREF: "fission.autostart",
   NEVER_ACTIVATE_PREF_VALUE: 0,
   ASK_TO_ACTIVATE_PREF_VALUE: 1,
   ALWAYS_ACTIVATE_PREF_VALUE: 2,
 
   dbUrls: [
     {
       url: "flashallow.example.com/",
       db: "test-flashallow-simple",
@@ -377,16 +378,22 @@ var classifierTester = {
         }
       );
     }
 
     return fn(browser, classifierTester.IFRAME_ID, depth);
   },
 
   checkPluginInfo(pluginInfo, expectedClassification, flashSetting) {
+    // Flashblocking is disabled when fission is enabled, so all the classifications
+    // should be "unknown"
+    if (Services.prefs.getBoolPref(classifierTester.FISSION_PREF)) {
+      expectedClassification = "unknown";
+    }
+
     // We've stopped allowing flash to be always activated, so check
     // existing tests that attempt to do so get treated as using ask-to-activate.
     if (flashSetting == classifierTester.ALWAYS_ACTIVATE_PREF_VALUE) {
       flashSetting = classifierTester.ASK_TO_ACTIVATE_PREF_VALUE;
     }
     is(
       pluginInfo.flashClassification,
       expectedClassification,