Bug 1266889 - Plugin block list blocks SWF network requests, but does not prevent plugin instantiation. r=francois
authorTobias Schneider <schneider@jancona.com>
Fri, 22 Apr 2016 16:00:43 -0700
changeset 295793 c637d7478937ae9a68fc03a52b444427a6f616b0
parent 295792 d95633a61869a008b69da8d621c0d0d127874fe5
child 295794 cc1443870a878e094751dbd0eee36c4cee8a23a4
push id76090
push usercpeterson@mozilla.com
push dateTue, 03 May 2016 08:19:54 +0000
treeherdermozilla-inbound@c637d7478937 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1266889
milestone49.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 1266889 - Plugin block list blocks SWF network requests, but does not prevent plugin instantiation. r=francois
dom/base/nsObjectLoadingContent.cpp
modules/fdlibm/src/fdlibm.h.orig
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -6,16 +6,17 @@
 /*
  * A base class implementing nsIObjectLoadingContent for use by
  * various content nodes that want to provide plugin/document/image
  * loading functionality (eg <embed>, <object>, <applet>, etc).
  */
 
 // Interface headers
 #include "imgLoader.h"
+#include "nsIConsoleService.h"
 #include "nsIContent.h"
 #include "nsIContentInlines.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIDOMCustomEvent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLAppletElement.h"
@@ -82,16 +83,17 @@
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/PluginCrashedEvent.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
 #include "mozilla/dom/HTMLSharedObjectElement.h"
+#include "nsChannelClassifier.h"
 
 #ifdef XP_WIN
 // Thanks so much, Microsoft! :(
 #ifdef CreateEvent
 #undef CreateEvent
 #endif
 #endif // XP_WIN
 
@@ -101,16 +103,17 @@
 // maybe on nsIObjectLoadingContext.
 #include "mozilla/dom/HTMLObjectElement.h"
 #endif
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
 static const char *kPrefJavaMIME = "plugin.java.mime";
 static const char *kPrefYoutubeRewrite = "plugins.rewrite_youtube_embeds";
+static const char *kPrefBlockURIs = "browser.safebrowsing.blockedURIs.enabled";
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 static LogModule*
 GetObjectLog()
 {
   static LazyLogModule sLog("objlc");
@@ -1149,30 +1152,16 @@ nsObjectLoadingContent::OnStopRequest(ns
   // We make a note of this object node by including it in a dedicated
   // array of blocked tracking nodes under its parent document.
   if (aStatusCode == NS_ERROR_TRACKING_URI) {
     nsCOMPtr<nsIContent> thisNode =
       do_QueryInterface(static_cast<nsIObjectLoadingContent*>(this));
     if (thisNode && thisNode->IsInComposedDoc()) {
       thisNode->GetComposedDoc()->AddBlockedTrackingNode(thisNode);
     }
-  } else if (aStatusCode == NS_ERROR_BLOCKED_URI) {
-    // Logging is temporarily disabled until after experiment phase.
-    //
-    // nsAutoCString uri;
-    // mURI->GetSpec(uri);
-    // nsCOMPtr<nsIConsoleService> console(
-    //   do_GetService("@mozilla.org/consoleservice;1"));
-    // if (console) {
-    //   nsString message = NS_LITERAL_STRING("Blocking ") +
-    //     NS_ConvertASCIItoUTF16(uri) +
-    //     NS_LITERAL_STRING(" since it was found on an internal Firefox blocklist.");
-    //   console->LogStringMessage(message.get());
-    // }
-    Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1);
   }
 
   NS_ENSURE_TRUE(nsContentUtils::LegacyIsCallerChromeOrNativeCode(), NS_ERROR_NOT_AVAILABLE);
 
   if (aRequest != mChannel) {
     return NS_BINDING_ABORTED;
   }
 
@@ -2282,16 +2271,42 @@ nsObjectLoadingContent::LoadObject(bool 
     }
     // If we're loading a type now, check ProcessPolicy. Note that we may check
     // both now in the case of plugins whose type is determined before opening a
     // channel.
     if (allowLoad && mType != eType_Loading) {
       allowLoad = CheckProcessPolicy(&contentPolicy);
     }
 
+    // This needs to be reverted once the plugin stability experiment is over (see bug #1268120).
+    if (allowLoad && Preferences::GetBool(kPrefBlockURIs)) {
+      RefPtr<nsChannelClassifier> channelClassifier = new nsChannelClassifier();
+      nsCOMPtr<nsIURIClassifier> classifier = do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID);
+      if (classifier) {
+        nsAutoCString tables;
+        Preferences::GetCString("urlclassifier.blockedTable", &tables);
+        nsAutoCString results;
+        rv = classifier->ClassifyLocalWithTables(mURI, tables, results);
+        if (NS_SUCCEEDED(rv) && !results.IsEmpty()) {
+          nsAutoCString uri;
+          mURI->GetSpec(uri);
+          nsCOMPtr<nsIConsoleService> console(
+            do_GetService("@mozilla.org/consoleservice;1"));
+          if (console) {
+            nsString message = NS_LITERAL_STRING("Blocking ") +
+              NS_ConvertASCIItoUTF16(uri) +
+              NS_LITERAL_STRING(" since it was found on an internal Firefox blocklist.");
+            console->LogStringMessage(message.get());
+          }
+          Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1);
+          allowLoad = false;
+        }
+      }
+    }
+
     // Content policy implementations can mutate the DOM, check for re-entry
     if (!mIsLoading) {
       LOG(("OBJLC [%p]: We re-entered in content policy, leaving original load",
            this));
       return NS_OK;
     }
 
     // Load denied, switch to fallback and set disabled/suppressed if applicable
deleted file mode 100644
--- a/modules/fdlibm/src/fdlibm.h.orig
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * from: @(#)fdlibm.h 5.1 93/09/24
- * $FreeBSD$
- */
-
-#ifndef mozilla_imported_fdlibm_h
-#define mozilla_imported_fdlibm_h
-
-double	acos(double);
-double	asin(double);
-double	atan(double);
-double	atan2(double, double);
-
-double	cosh(double);
-double	sinh(double);
-double	tanh(double);
-
-double	exp(double);
-double	log(double);
-double	log10(double);
-
-double	pow(double, double);
-double	sqrt(double);
-
-double	ceil(double);
-float	ceilf(float);
-double	fabs(double);
-double	floor(double);
-
-double	acosh(double);
-double	asinh(double);
-double	atanh(double);
-double	cbrt(double);
-double	expm1(double);
-double	hypot(double, double);
-double	log1p(double);
-double	log2(double);
-
-double	copysign(double, double);
-double	scalbn(double, int);
-double	trunc(double);
-
-float	floorf(float);
-
-#endif /* mozilla_imported_fdlibm_h */