Backed out changesets 5a3092c456c0,8dcbfd14f1e5 (bug 1218433) for M3, W3 failures and M10 failure on Android. r=backout

* * *
Backed out changeset 8dcbfd14f1e5 (bug 1218433)


462 INFO TEST-UNEXPECTED-FAIL | dom/security/test/csp/test_child-src_worker-redirect.html | CSP child-src worker test other-src-worker_redir-same - got "Error: Failed to load script (nsresult = 0x805e0006)", expected "blocked"
479 INFO TEST-UNEXPECTED-FAIL | dom/security/test/csp/test_child-src_worker.html | Test timed out.
486 INFO TEST-UNEXPECTED-FAIL | dom/security/test/csp/test_child-src_worker_data.html | Test timed out.
This commit is contained in:
Sebastian Hengst 2015-11-12 18:44:51 +01:00
Родитель 4acd4505dd
Коммит c7cc4bc5c8
16 изменённых файлов: 213 добавлений и 245 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -122,32 +122,46 @@ ChannelFromScriptURL(nsIPrincipal* principal,
return NS_ERROR_DOM_SYNTAX_ERR;
}
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
@ -155,7 +169,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
rv = NS_NewChannel(getter_AddRefs(channel),
uri,
parentDoc,
secFlags,
nsILoadInfo::SEC_NORMAL,
aContentPolicyType,
loadGroup,
nullptr, // aCallbacks
@ -170,7 +184,7 @@ ChannelFromScriptURL(nsIPrincipal* principal,
rv = NS_NewChannel(getter_AddRefs(channel),
uri,
principal,
secFlags,
nsILoadInfo::SEC_NORMAL,
aContentPolicyType,
loadGroup,
nullptr, // aCallbacks
@ -472,51 +486,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;
@ -594,27 +571,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);
@ -668,7 +663,7 @@ private:
}
RefPtr<CachePromiseHandler> promiseHandler =
new CachePromiseHandler(this, loadInfo, aIndex);
new CachePromiseHandler(this, loadInfo, index);
cachePromise->AppendNativeHandler(promiseHandler);
loadInfo.mCachePromise.swap(cachePromise);
@ -677,6 +672,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
{
@ -779,7 +782,6 @@ private:
++index) {
nsresult rv = LoadScript(index);
if (NS_WARN_IF(NS_FAILED(rv))) {
LoadingFinished(index, rv);
return rv;
}
}
@ -877,18 +879,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;
}
@ -907,12 +918,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;
}
@ -924,9 +935,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();
@ -1083,6 +1094,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.
@ -1226,21 +1244,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,
@ -1502,14 +1508,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;
}
@ -1517,7 +1518,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;

Просмотреть файл

@ -39,8 +39,10 @@ worker.onmessage = function(event) {
}
msg = "Loading data:something";
worker = new Worker("data:application/javascript;base64,ZHVtcCgnaGVsbG8gd29ybGQnKQo=");
worker.onerror = function() {
try {
worker = new Worker("data:application/javascript;base64,ZHVtcCgnaGVsbG8gd29ybGQnKQo=");
ok(false, "Should have thrown!");
} catch (e) {
ok(true, "Threw as expected.");
}

Просмотреть файл

@ -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();

Просмотреть файл

@ -2,3 +2,7 @@
type: testharness
[unsupported_scheme]
expected: FAIL
[javascript_url]
expected: FAIL

Просмотреть файл

@ -2,3 +2,7 @@
type: testharness
[unsupported_scheme]
expected: FAIL
[javascript_url]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[004.html]
type: testharness
[importScripts broken script]
expected: FAIL

Просмотреть файл

@ -0,0 +1,6 @@
[006.html]
type: testharness
expected: ERROR
[importScripts uncaught exception]
expected: TIMEOUT

Просмотреть файл

@ -31,10 +31,6 @@ connect-src 'self'; script-src 'self' 'unsafe-inline'; child-src 'self';
worker.onmessage = function(event) {
alert_assert(event.data);
};
worker.onerror = function(event) {
alert_assert('TEST COMPLETE');
event.preventDefault();
}
} catch (e) {
alert_assert('TEST COMPLETE');
}

Просмотреть файл

@ -31,10 +31,6 @@ connect-src 'self'; script-src 'self' 'unsafe-inline'; child-src *;
worker.onmessage = function(event) {
alert_assert(event.data);
};
worker.onerror = function(event) {
event.preventDefault();
alert_assert('TEST COMPLETE');
}
} catch (e) {
alert_assert('TEST COMPLETE');
}

Просмотреть файл

@ -20,9 +20,6 @@ child-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-inline'; connect-src
foo.onmessage = function(event) {
alert_assert("FAIL");
};
foo.onerror = function(e) {
alert_assert("PASS");
}
} catch (e) {
alert_assert("PASS");
}

Просмотреть файл

@ -83,8 +83,7 @@ function setAttributes(el, attrs) {
function bindEvents(element, resolveEventName, rejectEventName) {
element.eventPromise = new Promise(function(resolve, reject) {
element.addEventListener(resolveEventName || "load", resolve);
element.addEventListener(rejectEventName || "error",
function(e) { e.preventDefault(); reject(); } );
element.addEventListener(rejectEventName || "error", reject);
});
}

Просмотреть файл

@ -4,14 +4,9 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
async_test(function(t) {
try {
var w = new Worker("ftp://example.org/support/WorkerBasic.js");
w.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
test(function() {
assert_throws("SECURITY_ERR", function() {
new Worker("ftp://example.org/support/WorkerBasic.js");
});
});
</script>

Просмотреть файл

@ -12,54 +12,35 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('unsupported:', ''); });
}, "unsupported_scheme");
async_test(function() {
var worker = new SharedWorker('data:,onconnect = function(e) { e.ports[0].postMessage(1); }', '');
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, 1);
});
}, "data_url");
async_test(function(t) {
testSharedWorkerHelper(this, 'javascript:""');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('javascript:""', ''); });
}, "javascript_url");
async_test(function(t) {
testSharedWorkerHelper(this, 'about:blank');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('about:blank', ''); });
}, "about_blank");
async_test(function(t) {
testSharedWorkerHelper(this, 'http://www.opera.com/');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://www.opera.com/', ''); });
}, "opera_com");
async_test(function(t) {
testSharedWorkerHelper(this, location.protocol+'//'+location.hostname+':81/');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker(location.protocol+'//'+location.hostname+':81/', ''); });
}, "port_81");
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':80/');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':80/', ''); });
}, "https_port_80");
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':8000/');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':8000/', ''); });
}, "https_port_8000");
async_test(function(t) {
testSharedWorkerHelper(this, 'http://'+location.hostname+':8012/');
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://'+location.hostname+':8012/', ''); });
}, "http_port_8012");
</script>
<!--

Просмотреть файл

@ -10,17 +10,6 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new Worker('unsupported:'); });
}, "unsupported_scheme");
@ -32,32 +21,31 @@ async_test(function() {
});
}, "data_url");
async_test(function(t) {
testSharedWorkerHelper(t, 'about:blank');
test(function() {
assert_throws("SecurityError", function() { new Worker('about:blank'); });
}, "about_blank");
async_test(function(t) {
testSharedWorkerHelper(t, 'http://www.example.invalid/');
test(function() {
assert_throws("SecurityError", function() { new Worker('http://www.example.invalid/'); });
}, "example_invalid");
async_test(function(t) {
testSharedWorkerHelper(t, location.protocol+'//'+location.hostname+':81/');
test(function() {
assert_throws("SecurityError", function() { new Worker(location.protocol+'//'+location.hostname+':81/'); });
}, "port_81");
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':80/');
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':80/'); });
}, "https_port_80");
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':8000/');
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':8000/'); });
}, "https_port_8000");
async_test(function(t) {
testSharedWorkerHelper(t, 'http://'+location.hostname+':8012/');
test(function() {
assert_throws("SecurityError", function() { new Worker('http://'+location.hostname+':8012/'); });
}, "http_post_8012");
async_test(function(t) {
testSharedWorkerHelper(t,'javascript:""');
test(function() {
assert_throws("SecurityError", function() { new Worker('javascript:""'); });
}, "javascript_url");
</script>