Backed out changeset 439e1f841ea2 (bug 1148935) for Werror bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-06-17 15:48:16 -04:00
parent e75d563da7
commit aff6e663bd
17 changed files with 16 additions and 153 deletions

View File

@ -214,7 +214,7 @@ nsScriptLoader::CheckContentPolicy(nsIDocument* aDocument,
const nsAString &aType)
{
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_INTERNAL_SCRIPT,
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT,
aURI,
aDocument->NodePrincipal(),
aContext,
@ -289,7 +289,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
aRequest->mURI,
mDocument,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_INTERNAL_SCRIPT,
nsIContentPolicy::TYPE_SCRIPT,
loadGroup,
prompter,
nsIRequest::LOAD_NORMAL |

View File

@ -113,15 +113,9 @@ InternalRequest::MapContentPolicyTypeToRequestContext(nsContentPolicyType aConte
case nsIContentPolicy::TYPE_OTHER:
context = RequestContext::Internal;
break;
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
case nsIContentPolicy::TYPE_SCRIPT:
context = RequestContext::Script;
break;
case nsIContentPolicy::TYPE_INTERNAL_WORKER:
context = RequestContext::Worker;
break;
case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
context = RequestContext::Sharedworker;
break;
case nsIContentPolicy::TYPE_IMAGE:
context = RequestContext::Image;
break;

View File

@ -53,13 +53,13 @@ namespace dom {
* ping | TYPE_PING
* plugin | TYPE_OBJECT_SUBREQUEST
* prefetch |
* script | TYPE_INTERNAL_SCRIPT
* sharedworker | TYPE_INTERNAL_SHARED_WORKER
* script | TYPE_SCRIPT
* sharedworker |
* subresource | Not supported by Gecko
* style | TYPE_STYLESHEET
* track | TYPE_INTERNAL_TRACK
* video | TYPE_INTERNAL_VIDEO
* worker | TYPE_INTERNAL_WORKER
* worker |
* xmlhttprequest | TYPE_XMLHTTPREQUEST
* xslt | TYPE_XSLT
*
@ -68,6 +68,7 @@ namespace dom {
* TODO: Split TYPE_XMLHTTPREQUEST and TYPE_DATAREQUEST for EventSource
* TODO: Figure out if TYPE_WEBSOCKET maps to anything useful
* TODO: Differentiate between frame and iframe
* TODO: Add content types for different kinds of workers
* TODO: Add a content type for prefetch
* TODO: Use the content type for manifest when it becomes available
* TODO: Add a content type for location

View File

@ -2344,7 +2344,7 @@ RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal,
nsresult rv = WorkerPrivate::GetLoadInfo(cx, window, nullptr, aScriptURL,
false,
WorkerPrivate::OverrideLoadGroup,
aType, &loadInfo);
&loadInfo);
NS_ENSURE_SUCCESS(rv, rv);
return CreateSharedWorkerFromLoadInfo(cx, &loadInfo, aScriptURL, aName, aType,

View File

@ -95,7 +95,6 @@ ChannelFromScriptURL(nsIPrincipal* principal,
const nsAString& aScriptURL,
bool aIsMainScript,
WorkerScriptType aWorkerScriptType,
nsContentPolicyType aContentPolicyType,
nsIChannel** aChannel)
{
AssertIsOnMainThread();
@ -112,7 +111,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
// If we're part of a document then check the content load policy.
if (parentDoc) {
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(aContentPolicyType, uri,
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT, uri,
principal, parentDoc,
NS_LITERAL_CSTRING("text/javascript"),
nullptr, &shouldLoad,
@ -167,7 +166,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
uri,
parentDoc,
nsILoadInfo::SEC_NORMAL,
aContentPolicyType,
nsIContentPolicy::TYPE_SCRIPT,
loadGroup,
nullptr, // aCallbacks
flags,
@ -182,7 +181,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
uri,
principal,
nsILoadInfo::SEC_NORMAL,
aContentPolicyType,
nsIContentPolicy::TYPE_SCRIPT,
loadGroup,
nullptr, // aCallbacks
flags,
@ -808,9 +807,7 @@ private:
if (!channel) {
rv = ChannelFromScriptURL(principal, baseURI, parentDoc, loadGroup, ios,
secMan, loadInfo.mURL, IsMainWorkerScript(),
mWorkerScriptType,
mWorkerPrivate->ContentPolicyType(),
getter_AddRefs(channel));
mWorkerScriptType, getter_AddRefs(channel));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -1522,8 +1519,6 @@ public:
scriptloader::ChannelFromScriptURLMainThread(principal, baseURI,
parentDoc, loadGroup,
mScriptURL,
// Nested workers are always dedicated.
nsIContentPolicy::TYPE_INTERNAL_WORKER,
getter_AddRefs(channel));
if (NS_SUCCEEDED(mResult)) {
channel.forget(mChannel);
@ -1735,7 +1730,6 @@ ChannelFromScriptURLMainThread(nsIPrincipal* aPrincipal,
nsIDocument* aParentDoc,
nsILoadGroup* aLoadGroup,
const nsAString& aScriptURL,
nsContentPolicyType aContentPolicyType,
nsIChannel** aChannel)
{
AssertIsOnMainThread();
@ -1746,8 +1740,7 @@ ChannelFromScriptURLMainThread(nsIPrincipal* aPrincipal,
NS_ASSERTION(secMan, "This should never be null!");
return ChannelFromScriptURL(aPrincipal, aBaseURI, aParentDoc, aLoadGroup,
ios, secMan, aScriptURL, true, WorkerScript,
aContentPolicyType, aChannel);
ios, secMan, aScriptURL, true, WorkerScript, aChannel);
}
nsresult

View File

@ -8,7 +8,6 @@
#define mozilla_dom_workers_scriptloader_h__
#include "Workers.h"
#include "nsIContentPolicyBase.h"
class nsIPrincipal;
class nsIURI;
@ -38,7 +37,6 @@ ChannelFromScriptURLMainThread(nsIPrincipal* aPrincipal,
nsIDocument* aParentDoc,
nsILoadGroup* aLoadGroup,
const nsAString& aScriptURL,
nsContentPolicyType aContentPolicyType,
nsIChannel** aChannel);
nsresult

View File

@ -2550,7 +2550,6 @@ ServiceWorkerManager::CreateServiceWorkerForWindow(nsPIDOMWindow* aWindow,
NS_ConvertUTF8toUTF16(aInfo->ScriptSpec()),
false,
WorkerPrivate::OverrideLoadGroup,
WorkerTypeService,
&loadInfo);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;

View File

@ -88,13 +88,10 @@ public:
return rv;
}
// Note that because there is no "serviceworker" RequestContext type, we can
// use the external TYPE_SCRIPT content policy types when loading a service
// worker.
rv = NS_NewChannel(getter_AddRefs(mChannel),
uri, aPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_SCRIPT);
nsIContentPolicy::TYPE_SCRIPT); // FIXME(nsm): TYPE_SERVICEWORKER
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

View File

@ -4842,7 +4842,7 @@ WorkerPrivate::Constructor(JSContext* aCx,
nsresult rv = GetLoadInfo(aCx, nullptr, parent, aScriptURL,
aIsChromeWorker, InheritLoadGroup,
aWorkerType, stackLoadInfo.ptr());
stackLoadInfo.ptr());
if (NS_FAILED(rv)) {
scriptloader::ReportLoadError(aCx, aScriptURL, rv, !parent);
aRv.Throw(rv);
@ -4900,7 +4900,6 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
WorkerPrivate* aParent, const nsAString& aScriptURL,
bool aIsChromeWorker,
LoadGroupBehavior aLoadGroupBehavior,
WorkerType aWorkerType,
WorkerLoadInfo* aLoadInfo)
{
using namespace mozilla::dom::workers::scriptloader;
@ -5146,7 +5145,6 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow,
rv = ChannelFromScriptURLMainThread(loadInfo.mPrincipal, loadInfo.mBaseURI,
document, loadInfo.mLoadGroup,
aScriptURL,
ContentPolicyType(aWorkerType),
getter_AddRefs(loadInfo.mChannel));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -9,7 +9,6 @@
#include "Workers.h"
#include "nsIContentPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "nsILoadGroup.h"
#include "nsIWorkerDebugger.h"
@ -735,27 +734,6 @@ public:
return mWorkerType == WorkerTypeService;
}
nsContentPolicyType
ContentPolicyType() const
{
return ContentPolicyType(mWorkerType);
}
static nsContentPolicyType
ContentPolicyType(WorkerType aWorkerType)
{
switch (aWorkerType) {
case WorkerTypeDedicated:
return nsIContentPolicy::TYPE_INTERNAL_WORKER;
case WorkerTypeShared:
return nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER;
case WorkerTypeService:
return nsIContentPolicy::TYPE_SCRIPT;
default:
MOZ_ASSERT_UNREACHABLE("Invalid worker type");
}
}
const nsCString&
SharedWorkerName() const
{
@ -991,8 +969,7 @@ public:
static nsresult
GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow, WorkerPrivate* aParent,
const nsAString& aScriptURL, bool aIsChromeWorker,
LoadGroupBehavior aLoadGroupBehavior, WorkerType aWorkerType,
WorkerLoadInfo* aLoadInfo);
LoadGroupBehavior aLoadGroupBehavior, WorkerLoadInfo* aLoadInfo);
static void
OverrideLoadInfoLoadGroup(WorkerLoadInfo& aLoadInfo);

View File

@ -70,22 +70,6 @@ self.addEventListener("fetch", function(event) {
}
} else if (event.request.url.indexOf("xslt") >= 0) {
respondToServiceWorker(event, "xslt");
} else if (event.request.url.indexOf("myworker") >= 0) {
if (event.request.context == "worker") {
event.respondWith(fetch("worker.js"));
}
} else if (event.request.url.indexOf("myparentworker") >= 0) {
if (event.request.context == "worker") {
event.respondWith(fetch("parentworker.js"));
}
} else if (event.request.url.indexOf("mysharedworker") >= 0) {
if (event.request.context == "sharedworker") {
event.respondWith(fetch("sharedworker.js"));
}
} else if (event.request.url.indexOf("myparentsharedworker") >= 0) {
if (event.request.context == "sharedworker") {
event.respondWith(fetch("parentsharedworker.js"));
}
} else if (event.request.url.indexOf("cache") >= 0) {
var cache;
var origContext = event.request.context;

View File

@ -341,58 +341,6 @@
});
}
function testWorker() {
return new Promise(function(resolve, reject) {
var worker = new Worker("myworker");
worker.onmessage = function(e) {
if (e.data == "ack") {
worker.terminate();
resolve();
}
};
worker.onerror = reject;
});
}
function testNestedWorker() {
return new Promise(function(resolve, reject) {
var worker = new Worker("myparentworker");
worker.onmessage = function(e) {
if (e.data == "ack") {
worker.terminate();
resolve();
}
};
worker.onerror = reject;
});
}
function testSharedWorker() {
return new Promise(function(resolve, reject) {
var worker = new SharedWorker("mysharedworker");
worker.port.start();
worker.port.onmessage = function(e) {
if (e.data == "ack") {
resolve();
}
};
worker.onerror = reject;
});
}
function testNestedWorkerInSharedWorker() {
return new Promise(function(resolve, reject) {
var worker = new SharedWorker("myparentsharedworker");
worker.port.start();
worker.port.onmessage = function(e) {
if (e.data == "ack") {
resolve();
}
};
worker.onerror = reject;
});
}
function testCache() {
return new Promise(function(resolve, reject) {
// Issue an XHR that will be intercepted by the SW in order to start off
@ -435,10 +383,6 @@
testTrack(),
testXHR(),
testXSLT(),
testWorker(),
testNestedWorker(),
testSharedWorker(),
testNestedWorkerInSharedWorker(),
// Also, test to see if the type of the request can be persisted in the database.
testCache(),

View File

@ -1,8 +0,0 @@
onconnect = function(e) {
e.ports[0].start();
var worker = new Worker("myworker?shared");
worker.onmessage = function(e2) {
e.ports[0].postMessage(e2.data);
self.close();
};
};

View File

@ -1,4 +0,0 @@
var worker = new Worker("myworker");
worker.onmessage = function(e) {
postMessage(e.data);
};

View File

@ -1,5 +0,0 @@
onconnect = function(e) {
e.ports[0].start();
e.ports[0].postMessage("ack");
self.close();
};

View File

@ -1 +0,0 @@
postMessage("ack");

View File

@ -38,10 +38,6 @@ support-files =
fetch/context/beacon.sjs
fetch/context/csp-violate.sjs
fetch/context/ping.html
fetch/context/worker.js
fetch/context/parentworker.js
fetch/context/sharedworker.js
fetch/context/parentsharedworker.js
fetch/context/xml.xml
fetch/https/index.html
fetch/https/register.html