mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Backed out 2 changesets (bug 1218433) for wpt failures CLOSED TREE
Backed out changeset 1cc8cc0444c0 (bug 1218433) Backed out changeset 5418ca0e0378 (bug 1218433) --HG-- extra : commitid : H1h8VHrzxx8
This commit is contained in:
parent
7ebb7aa32e
commit
9d1f194cbb
@ -42,9 +42,14 @@
|
||||
|
||||
// test loading with relative url - this should fail since we are
|
||||
// sandboxed and have a null principal
|
||||
var worker_js = new Worker('file_iframe_sandbox_worker.js');
|
||||
try {
|
||||
var worker_js = new Worker('file_iframe_sandbox_worker.js');
|
||||
} catch (e) {
|
||||
ok(e.name === "SecurityError", "a worker in a sandboxed document should throw when loading from a relative URI");
|
||||
}
|
||||
|
||||
worker_js.onerror = function(error) {
|
||||
ok(true, "a worker in a sandboxed document should tell the load error via error event");
|
||||
ok(false, "a worker in a sandboxed document should not tell the load error via error event");
|
||||
}
|
||||
|
||||
worker_js.addEventListener('message', function(event) {
|
||||
|
@ -23,12 +23,6 @@
|
||||
page_id);
|
||||
worker.port.start();
|
||||
|
||||
worker.onerror = function(evt) {
|
||||
evt.preventDefault();
|
||||
window.parent.postMessage({id:page_id, message:"blocked"},
|
||||
'http://mochi.test:8888');
|
||||
}
|
||||
|
||||
worker.port.onmessage = function(ev) {
|
||||
window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888');
|
||||
};
|
||||
|
@ -13,12 +13,6 @@
|
||||
page_id);
|
||||
worker.port.start();
|
||||
|
||||
worker.onerror = function(evt) {
|
||||
evt.preventDefault();
|
||||
window.parent.postMessage({id:page_id, message:"blocked"},
|
||||
'http://mochi.test:8888');
|
||||
}
|
||||
|
||||
worker.port.onmessage = function(ev) {
|
||||
window.parent.postMessage({id:page_id, message:"allowed"},
|
||||
'http://mochi.test:8888');
|
||||
|
@ -18,11 +18,6 @@
|
||||
escape(shared_worker), page_id);
|
||||
worker.port.start();
|
||||
|
||||
worker.onerror = function(evt) {
|
||||
evt.preventDefault();
|
||||
window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888');
|
||||
}
|
||||
|
||||
worker.port.onmessage = function(ev) {
|
||||
window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888');
|
||||
};
|
||||
|
@ -24,12 +24,11 @@
|
||||
|
||||
worker.onerror = function(error) {
|
||||
var msg = error.message;
|
||||
if (msg.match(/^: NetworkError/) || msg.match(/Failed to load script/)) {
|
||||
if (msg.match(/^: NetworkError/)) {
|
||||
// this means CSP blocked it
|
||||
msg = "blocked";
|
||||
}
|
||||
window.parent.postMessage({id:page_id, message:msg}, 'http://mochi.test:8888');
|
||||
error.preventDefault();
|
||||
};
|
||||
|
||||
worker.onmessage = function(ev) {
|
||||
|
@ -8,16 +8,9 @@
|
||||
page_id = window.location.hash.substring(1);
|
||||
try {
|
||||
worker = new Worker('file_testserver.sjs?file='+escape("tests/dom/security/test/csp/file_child-src_worker.js"));
|
||||
|
||||
worker.onerror = function(e) {
|
||||
window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888');
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
worker.onmessage = function(ev) {
|
||||
window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888');
|
||||
}
|
||||
|
||||
};
|
||||
worker.postMessage('foo');
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -8,16 +8,9 @@
|
||||
page_id = window.location.hash.substring(1);
|
||||
try {
|
||||
worker = new Worker('data:application/javascript;charset=UTF-8,'+escape('onmessage = function(e) { postMessage("worker"); };'));
|
||||
|
||||
worker.onerror = function(e) {
|
||||
window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888');
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
worker.onmessage = function(ev) {
|
||||
window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888');
|
||||
}
|
||||
|
||||
};
|
||||
worker.postMessage('foo');
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>frame for storage prevented test</title>
|
||||
|
||||
<script type="text/javascript" src="https://example.com/tests/dom/tests/mochitest/general/storagePermissionsUtils.js"></script>
|
||||
<script type="text/javascript;version=1.7">
|
||||
<script type="text/javascript">
|
||||
|
||||
task(function* () {
|
||||
// We shouldn't be able to access storage
|
||||
@ -13,24 +13,12 @@
|
||||
// This hash of the URI is set to #nullprincipal by the test if the current page has a null principal,
|
||||
// and thus attempting to create a dedicated worker will throw
|
||||
if (location.hash == "#nullprincipal") {
|
||||
function createWorker() {
|
||||
return new Promise((resolve, reject) => {
|
||||
var w;
|
||||
try {
|
||||
w = new Worker("workerStoragePrevented.js");
|
||||
} catch (e) {
|
||||
ok(true, "Running workers was prevented");
|
||||
resolve();
|
||||
}
|
||||
|
||||
w.onerror = function() {
|
||||
ok(true, "Running workers was prevented");
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
try {
|
||||
new Worker("workerStoragePrevented.js");
|
||||
ok(false, "Running workers should not have been allowed");
|
||||
} catch (e) {
|
||||
ok(true, "Running workers was prevented");
|
||||
}
|
||||
|
||||
yield createWorker();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -130,32 +130,46 @@ ChannelFromScriptURL(nsIPrincipal* principal,
|
||||
parentDoc = nullptr;
|
||||
}
|
||||
|
||||
aLoadFlags |= nsIChannel::LOAD_CLASSIFY_URI;
|
||||
uint32_t secFlags = aIsMainScript ? nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED
|
||||
: nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(aContentPolicyType, uri,
|
||||
principal, parentDoc,
|
||||
NS_LITERAL_CSTRING("text/javascript"),
|
||||
nullptr, &shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
secMan);
|
||||
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) {
|
||||
if (NS_FAILED(rv) || shouldLoad != nsIContentPolicy::REJECT_TYPE) {
|
||||
return rv = NS_ERROR_CONTENT_BLOCKED;
|
||||
}
|
||||
return rv = NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
|
||||
}
|
||||
|
||||
if (aWorkerScriptType == DebuggerScript) {
|
||||
// A DebuggerScript needs to be a local resource like chrome: or resource:
|
||||
bool isUIResource = false;
|
||||
rv = NS_URIChainHasFlags(uri, nsIProtocolHandler::URI_IS_UI_RESOURCE,
|
||||
&isUIResource);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
bool isChrome = false;
|
||||
NS_ENSURE_SUCCESS(uri->SchemeIs("chrome", &isChrome),
|
||||
NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
||||
if (!isUIResource) {
|
||||
bool isResource = false;
|
||||
NS_ENSURE_SUCCESS(uri->SchemeIs("resource", &isResource),
|
||||
NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
||||
if (!isChrome && !isResource) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
secFlags |= nsILoadInfo::SEC_ALLOW_CHROME;
|
||||
} else if (aIsMainScript) {
|
||||
// We pass true as the 3rd argument to checkMayLoad here.
|
||||
// This allows workers in sandboxed documents to load data URLs
|
||||
// (and other URLs that inherit their principal from their
|
||||
// creator.)
|
||||
rv = principal->CheckMayLoad(uri, false, true);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
else {
|
||||
rv = secMan->CheckLoadURIWithPrincipal(principal, uri, 0);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
|
||||
// Note: this is for backwards compatibility and goes against spec.
|
||||
// We should find a better solution.
|
||||
bool isData = false;
|
||||
if (aIsMainScript && NS_SUCCEEDED(uri->SchemeIs("data", &isData)) && isData) {
|
||||
secFlags = nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL;
|
||||
}
|
||||
aLoadFlags |= nsIChannel::LOAD_CLASSIFY_URI;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// If we have the document, use it. Unfortunately, for dedicated workers
|
||||
@ -166,7 +180,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
uri,
|
||||
parentDoc,
|
||||
secFlags,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
aContentPolicyType,
|
||||
loadGroup,
|
||||
nullptr, // aCallbacks
|
||||
@ -181,7 +195,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
uri,
|
||||
principal,
|
||||
secFlags,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
aContentPolicyType,
|
||||
loadGroup,
|
||||
nullptr, // aCallbacks
|
||||
@ -483,51 +497,14 @@ private:
|
||||
|
||||
NS_IMPL_ISUPPORTS0(CachePromiseHandler)
|
||||
|
||||
class LoaderListener final : public nsIStreamLoaderObserver
|
||||
, public nsIRequestObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
LoaderListener(ScriptLoaderRunnable* aRunnable, uint32_t aIndex)
|
||||
: mRunnable(aRunnable)
|
||||
, mIndex(aIndex)
|
||||
{
|
||||
MOZ_ASSERT(mRunnable);
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
|
||||
nsresult aStatus, uint32_t aStringLen,
|
||||
const uint8_t* aString) override;
|
||||
|
||||
NS_IMETHOD
|
||||
OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) override;
|
||||
|
||||
NS_IMETHOD
|
||||
OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
|
||||
nsresult aStatusCode) override
|
||||
{
|
||||
// Nothing to do here!
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~LoaderListener() {}
|
||||
|
||||
RefPtr<ScriptLoaderRunnable> mRunnable;
|
||||
uint32_t mIndex;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(LoaderListener, nsIStreamLoaderObserver, nsIRequestObserver)
|
||||
|
||||
class ScriptLoaderRunnable final : public WorkerFeature
|
||||
, public nsIRunnable
|
||||
class ScriptLoaderRunnable final : public WorkerFeature,
|
||||
public nsIRunnable,
|
||||
public nsIStreamLoaderObserver,
|
||||
public nsIRequestObserver
|
||||
{
|
||||
friend class ScriptExecutorRunnable;
|
||||
friend class CachePromiseHandler;
|
||||
friend class CacheScriptLoader;
|
||||
friend class LoaderListener;
|
||||
|
||||
WorkerPrivate* mWorkerPrivate;
|
||||
nsCOMPtr<nsIEventTarget> mSyncLoopTarget;
|
||||
@ -605,27 +582,45 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
OnStreamComplete(nsIStreamLoader* aLoader, uint32_t aIndex,
|
||||
NS_IMETHOD
|
||||
OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
|
||||
nsresult aStatus, uint32_t aStringLen,
|
||||
const uint8_t* aString)
|
||||
const uint8_t* aString) override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aIndex < mLoadInfos.Length());
|
||||
|
||||
nsresult rv = OnStreamCompleteInternal(aLoader, aStatus, aStringLen,
|
||||
aString, mLoadInfos[aIndex]);
|
||||
LoadingFinished(aIndex, rv);
|
||||
nsCOMPtr<nsISupportsPRUint32> indexSupports(do_QueryInterface(aContext));
|
||||
NS_ASSERTION(indexSupports, "This should never fail!");
|
||||
|
||||
uint32_t index = UINT32_MAX;
|
||||
if (NS_FAILED(indexSupports->GetData(&index)) ||
|
||||
index >= mLoadInfos.Length()) {
|
||||
NS_ERROR("Bad index!");
|
||||
}
|
||||
|
||||
ScriptLoadInfo& loadInfo = mLoadInfos[index];
|
||||
|
||||
nsresult rv = OnStreamCompleteInternal(aLoader, aContext, aStatus,
|
||||
aStringLen, aString, loadInfo);
|
||||
LoadingFinished(index, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
OnStartRequest(nsIRequest* aRequest, uint32_t aIndex)
|
||||
NS_IMETHOD
|
||||
OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aIndex < mLoadInfos.Length());
|
||||
|
||||
ScriptLoadInfo& loadInfo = mLoadInfos[aIndex];
|
||||
nsCOMPtr<nsISupportsPRUint32> indexSupports(do_QueryInterface(aContext));
|
||||
MOZ_ASSERT(indexSupports, "This should never fail!");
|
||||
|
||||
uint32_t index = UINT32_MAX;
|
||||
if (NS_FAILED(indexSupports->GetData(&index)) ||
|
||||
index >= mLoadInfos.Length()) {
|
||||
MOZ_CRASH("Bad index!");
|
||||
}
|
||||
|
||||
ScriptLoadInfo& loadInfo = mLoadInfos[index];
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
MOZ_ASSERT(channel == loadInfo.mChannel);
|
||||
@ -679,7 +674,7 @@ private:
|
||||
}
|
||||
|
||||
RefPtr<CachePromiseHandler> promiseHandler =
|
||||
new CachePromiseHandler(this, loadInfo, aIndex);
|
||||
new CachePromiseHandler(this, loadInfo, index);
|
||||
cachePromise->AppendNativeHandler(promiseHandler);
|
||||
|
||||
loadInfo.mCachePromise.swap(cachePromise);
|
||||
@ -688,6 +683,14 @@ private:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
|
||||
nsresult aStatusCode) override
|
||||
{
|
||||
// Nothing to do here!
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
Notify(JSContext* aCx, Status aStatus) override
|
||||
{
|
||||
@ -790,7 +793,6 @@ private:
|
||||
++index) {
|
||||
nsresult rv = LoadScript(index);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
LoadingFinished(index, rv);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@ -888,18 +890,27 @@ private:
|
||||
|
||||
// We need to know which index we're on in OnStreamComplete so we know
|
||||
// where to put the result.
|
||||
RefPtr<LoaderListener> listener = new LoaderListener(this, aIndex);
|
||||
nsCOMPtr<nsISupportsPRUint32> indexSupports =
|
||||
do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = indexSupports->SetData(aIndex);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We don't care about progress so just use the simple stream loader for
|
||||
// OnStreamComplete notification only.
|
||||
nsCOMPtr<nsIStreamLoader> loader;
|
||||
rv = NS_NewStreamLoader(getter_AddRefs(loader), listener);
|
||||
rv = NS_NewStreamLoader(getter_AddRefs(loader), this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (loadInfo.mCacheStatus != ScriptLoadInfo::ToBeCached) {
|
||||
rv = channel->AsyncOpen2(loader);
|
||||
rv = channel->AsyncOpen(loader, indexSupports);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
@ -918,12 +929,12 @@ private:
|
||||
|
||||
nsCOMPtr<nsIStreamListenerTee> tee =
|
||||
do_CreateInstance(NS_STREAMLISTENERTEE_CONTRACTID);
|
||||
rv = tee->Init(loader, writer, listener);
|
||||
rv = tee->Init(loader, writer, this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult rv = channel->AsyncOpen2(tee);
|
||||
nsresult rv = channel->AsyncOpen(tee, indexSupports);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
@ -935,9 +946,9 @@ private:
|
||||
}
|
||||
|
||||
nsresult
|
||||
OnStreamCompleteInternal(nsIStreamLoader* aLoader, nsresult aStatus,
|
||||
uint32_t aStringLen, const uint8_t* aString,
|
||||
ScriptLoadInfo& aLoadInfo)
|
||||
OnStreamCompleteInternal(nsIStreamLoader* aLoader, nsISupports* aContext,
|
||||
nsresult aStatus, uint32_t aStringLen,
|
||||
const uint8_t* aString, ScriptLoadInfo& aLoadInfo)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
@ -1094,6 +1105,13 @@ private:
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We exempt data urls and other URI's that inherit their
|
||||
// principal again.
|
||||
if (NS_FAILED(loadPrincipal->CheckMayLoad(finalURI, false, true))) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
}
|
||||
|
||||
// The principal can change, but it should still match the original
|
||||
// load group's appId and browser element flag.
|
||||
@ -1237,21 +1255,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(ScriptLoaderRunnable, nsIRunnable)
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoaderListener::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
|
||||
nsresult aStatus, uint32_t aStringLen,
|
||||
const uint8_t* aString)
|
||||
{
|
||||
return mRunnable->OnStreamComplete(aLoader, mIndex, aStatus, aStringLen, aString);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoaderListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
{
|
||||
return mRunnable->OnStartRequest(aRequest, mIndex);
|
||||
}
|
||||
NS_IMPL_ISUPPORTS(ScriptLoaderRunnable, nsIRunnable,
|
||||
nsIStreamLoaderObserver,
|
||||
nsIRequestObserver)
|
||||
|
||||
void
|
||||
CachePromiseHandler::ResolvedCallback(JSContext* aCx,
|
||||
@ -1513,14 +1519,9 @@ CacheScriptLoader::ResolvedCallback(JSContext* aCx,
|
||||
|
||||
MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::Uncached);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (aValue.isUndefined()) {
|
||||
mLoadInfo.mCacheStatus = ScriptLoadInfo::ToBeCached;
|
||||
rv = mRunnable->LoadScript(mIndex);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
Fail(rv);
|
||||
}
|
||||
mRunnable->LoadScript(mIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1528,7 +1529,7 @@ CacheScriptLoader::ResolvedCallback(JSContext* aCx,
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
|
||||
mozilla::dom::Response* response = nullptr;
|
||||
rv = UNWRAP_OBJECT(Response, obj, response);
|
||||
nsresult rv = UNWRAP_OBJECT(Response, obj, response);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
Fail(rv);
|
||||
return;
|
||||
|
@ -13,53 +13,55 @@
|
||||
<script class="testbody" type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
function nextTest() {
|
||||
(function(){
|
||||
function workerfunc() {
|
||||
var subworker = new Worker("about:blank");
|
||||
subworker.onerror = function(e) {
|
||||
e.preventDefault();
|
||||
postMessage(e.message);
|
||||
}
|
||||
}
|
||||
var b = new Blob([workerfunc+'workerfunc();']);
|
||||
var u = URL.createObjectURL(b);
|
||||
function callworker(i) {
|
||||
try {
|
||||
var w = new Worker(u);
|
||||
URL.revokeObjectURL(u);
|
||||
is(i, 0, 'worker creation succeeded');
|
||||
} catch (e) {
|
||||
is(i, 1, 'worker creation failed');
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
w.onmessage = function(e) {
|
||||
is(e.data.indexOf('Error: Failed to load script'), 0, "Error: Failed to load script");
|
||||
if (++i < 2) callworker(i);
|
||||
else SimpleTest.finish();
|
||||
};
|
||||
}
|
||||
callworker(0);
|
||||
})();
|
||||
}
|
||||
|
||||
try {
|
||||
var worker = new Worker("about:blank");
|
||||
worker.onerror = function(e) {
|
||||
e.preventDefault();
|
||||
ok(true, "Shouldn't success!");
|
||||
nextTest();
|
||||
}
|
||||
ok(false, "Shouldn't success!");
|
||||
|
||||
worker.onmessage = function(event) {
|
||||
ok(false, "Shouldn't get a message!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
worker.onerror = function(event) {
|
||||
ok(false, "Shouldn't get a error message!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
} catch (e) {
|
||||
ok(false, "This should not happen.");
|
||||
ok(!worker, "worker should not be created");
|
||||
is(e.name, "SecurityError", "SecurityError should be thrown");
|
||||
is(e.code, DOMException.SECURITY_ERR, "SECURITY_ERR should be thrown");
|
||||
}
|
||||
|
||||
(function(){
|
||||
function workerfunc() {
|
||||
try {
|
||||
var subworker = new Worker("about:blank");
|
||||
postMessage({});
|
||||
} catch (e) {
|
||||
postMessage({name: e.name, code: e.code});
|
||||
}
|
||||
}
|
||||
var b = new Blob([workerfunc+'workerfunc();']);
|
||||
var u = URL.createObjectURL(b);
|
||||
function callworker(i) {
|
||||
try {
|
||||
var w = new Worker(u);
|
||||
URL.revokeObjectURL(u);
|
||||
is(i, 0, 'worker creation succeeded');
|
||||
} catch (e) {
|
||||
is(i, 1, 'worker creation failed');
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
w.onmessage = function(e) {
|
||||
is(e.data.name, "SecurityError", "SecurityError should be thrown");
|
||||
is(e.data.code, DOMException.SECURITY_ERR, "SECURITY_ERR should be thrown");
|
||||
if (++i < 2) callworker(i);
|
||||
else SimpleTest.finish();
|
||||
};
|
||||
}
|
||||
callworker(0);
|
||||
})();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
[self-doesnt-match-blob.sub.html]
|
||||
type: testharness
|
||||
expected: ERROR
|
||||
|
||||
[Violation report status OK.]
|
||||
expected: PASS
|
@ -1,2 +0,0 @@
|
||||
[star-doesnt-match-blob.sub.html]
|
||||
expected: ERROR
|
@ -1,10 +0,0 @@
|
||||
[child-src-worker-blocked.sub.html]
|
||||
type: testharness
|
||||
expected: ERROR
|
||||
|
||||
[Expecting alerts: ["PASS"\]]
|
||||
expected: PASS
|
||||
expected: NOTRUN
|
||||
|
||||
[Violation report status OK.]
|
||||
expected: PASS
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,2 +0,0 @@
|
||||
[no-opt-in-blocks.https.html]
|
||||
expected: ERROR
|
@ -1,4 +0,0 @@
|
||||
[Worker_cross_origin_security_err.htm]
|
||||
type: testharness
|
||||
[ Worker cross-origin URL ]
|
||||
expected: FAIL
|
@ -1,26 +1,8 @@
|
||||
[same-origin.html]
|
||||
type: testharness
|
||||
|
||||
[unsupported_scheme]
|
||||
expected: FAIL
|
||||
|
||||
[javascript_url]
|
||||
expected: FAIL
|
||||
|
||||
[about_blank]
|
||||
expected: FAIL
|
||||
|
||||
[opera_com]
|
||||
expected: FAIL
|
||||
|
||||
[port_81]
|
||||
expected: FAIL
|
||||
|
||||
[https_port_80]
|
||||
expected: FAIL
|
||||
|
||||
[https_port_8000]
|
||||
expected: FAIL
|
||||
|
||||
[http_port_8012]
|
||||
expected: FAIL
|
||||
|
@ -6,20 +6,3 @@
|
||||
[javascript_url]
|
||||
expected: FAIL
|
||||
|
||||
[about_blank]
|
||||
expected: FAIL
|
||||
|
||||
[example_invalid]
|
||||
expected: FAIL
|
||||
|
||||
[port_81]
|
||||
expected: FAIL
|
||||
|
||||
[https_port_80]
|
||||
expected: FAIL
|
||||
|
||||
[https_port_8000]
|
||||
expected: FAIL
|
||||
|
||||
[http_post_8012]
|
||||
expected: FAIL
|
||||
|
@ -0,0 +1,5 @@
|
||||
[004.html]
|
||||
type: testharness
|
||||
[importScripts broken script]
|
||||
expected: FAIL
|
||||
|
@ -0,0 +1,6 @@
|
||||
[006.html]
|
||||
type: testharness
|
||||
expected: ERROR
|
||||
[importScripts uncaught exception]
|
||||
expected: TIMEOUT
|
||||
|
Loading…
Reference in New Issue
Block a user