Bug 1132395 - URL.createObjectURL must be able to work with workers without parents, r=smaug

This commit is contained in:
Andrea Marchesini 2015-02-12 14:20:08 +01:00
Родитель 32b36a8170
Коммит 2ba37fdfb5
4 изменённых файлов: 40 добавлений и 2 удалений

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

@ -135,7 +135,8 @@ public:
principal = doc->NodePrincipal();
} else {
MOZ_ASSERT_IF(!mWorkerPrivate->GetParent(), mWorkerPrivate->IsChromeWorker());
// We use the worker Principal in case this is a SharedWorker, a
// ChromeWorker or a ServiceWorker.
principal = mWorkerPrivate->GetPrincipal();
}
@ -191,7 +192,8 @@ public:
principal = doc->NodePrincipal();
} else {
MOZ_ASSERT_IF(!mWorkerPrivate->GetParent(), mWorkerPrivate->IsChromeWorker());
// We use the worker Principal in case this is a SharedWorker, a
// ChromeWorker or a ServiceWorker.
principal = mWorkerPrivate->GetPrincipal();
}

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

@ -0,0 +1,5 @@
onconnect = function(evt) {
var blob = new Blob(['123'], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
evt.ports[0].postMessage('alive \\o/');
}

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

@ -98,6 +98,7 @@ support-files =
webSocket_sharedWorker.js
bug1104064_worker.js
worker_consoleAndBlobs.js
bug1132395_sharedWorker.js
[test_404.html]
[test_atob.html]
@ -199,3 +200,4 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s #bug 982828
[test_websocket_pref.html]
[test_bug1104064.html]
[test_consoleAndBlobs.html]
[test_bug1132395.html]

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

@ -0,0 +1,29 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Test for 1132395</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
var sw = new SharedWorker('bug1132395_sharedWorker.js');
sw.port.onmessage = function(event) {
ok(true, "We didn't crash.");
SimpleTest.finish();
}
});
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>