зеркало из https://github.com/mozilla/gecko-dev.git
Bug 788181. Fix instanceof for XHR and XHR.upload in workers. r=peterv
This commit is contained in:
Родитель
65e4105d26
Коммит
462c20197a
|
@ -984,11 +984,13 @@ CreateDedicatedWorkerGlobalScope(JSContext* aCx)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init other paris-bindings.
|
// Init other paris-bindings. Use GetProtoObject so the proto will
|
||||||
if (!XMLHttpRequestBinding_workers::CreateInterfaceObjects(aCx, global,
|
// be correctly cached in the proto cache. Otherwise we'll end up
|
||||||
global) ||
|
// double-calling CreateInterfaceObjects when we actually create an
|
||||||
!XMLHttpRequestUploadBinding_workers::CreateInterfaceObjects(aCx, global,
|
// object which has these protos, which breaks things like
|
||||||
global)) {
|
// instanceof.
|
||||||
|
if (!XMLHttpRequestBinding_workers::GetProtoObject(aCx, global, global) ||
|
||||||
|
!XMLHttpRequestUploadBinding_workers::GetProtoObject(aCx, global, global)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ MOCHITEST_FILES = \
|
||||||
importScripts_worker_imported2.js \
|
importScripts_worker_imported2.js \
|
||||||
importScripts_worker_imported3.js \
|
importScripts_worker_imported3.js \
|
||||||
importScripts_worker_imported4.js \
|
importScripts_worker_imported4.js \
|
||||||
|
test_instanceof.html \
|
||||||
|
instanceof_worker.js \
|
||||||
test_json.html \
|
test_json.html \
|
||||||
json_worker.js \
|
json_worker.js \
|
||||||
test_location.html \
|
test_location.html \
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
*/
|
||||||
|
onmessage = function(event) {
|
||||||
|
postMessage({event: "XMLHttpRequest",
|
||||||
|
status: (new XMLHttpRequest() instanceof XMLHttpRequest),
|
||||||
|
last: false });
|
||||||
|
postMessage({event: "XMLHttpRequestUpload",
|
||||||
|
status: ((new XMLHttpRequest()).upload instanceof XMLHttpRequestUpload),
|
||||||
|
last: true });
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<!--
|
||||||
|
Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
-->
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
Tests of DOM Worker JSON messages
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for DOM Worker Navigator</title>
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
<script src="json_worker.js" language="javascript"></script>
|
||||||
|
<script class="testbody" language="javascript">
|
||||||
|
|
||||||
|
var worker = new Worker("instanceof_worker.js");
|
||||||
|
|
||||||
|
worker.onmessage = function(event) {
|
||||||
|
ok(event.data.status, event.data.event);
|
||||||
|
|
||||||
|
if (event.data.last)
|
||||||
|
SimpleTest.finish();
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.postMessage(42);
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче