Bug 1266889 - Plugin block list blocks SWF network requests, but does not prevent plugin instantiation. r=francois

This commit is contained in:
Tobias Schneider 2016-04-22 16:00:43 -07:00
parent 0326676a67
commit 06c125d9b7
2 changed files with 29 additions and 70 deletions

View File

@ -11,6 +11,7 @@
// Interface headers
#include "imgLoader.h"
#include "nsIConsoleService.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsIDocShell.h"
@ -87,6 +88,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/HTMLObjectElementBinding.h"
#include "mozilla/dom/HTMLSharedObjectElement.h"
#include "nsChannelClassifier.h"
#ifdef XP_WIN
// Thanks so much, Microsoft! :(
@ -106,6 +108,7 @@ 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;
@ -1154,20 +1157,6 @@ nsObjectLoadingContent::OnStopRequest(nsIRequest *aRequest,
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);
@ -2287,6 +2276,32 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
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",

View File

@ -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 */