mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function(t) {
|
||||
var i = 0;
|
||||
addEventListener("message", function listener(evt) {
|
||||
t.step(function() {
|
||||
++i;
|
||||
removeEventListener("message", listener, true);
|
||||
});
|
||||
}, true);
|
||||
self.dispatchEvent(new Event("message"));
|
||||
self.dispatchEvent(new Event("message"));
|
||||
assert_equals(i, 1);
|
||||
}, "removeEventListener");
|
||||
|
||||
test(function() {
|
||||
addEventListener("message", this.step_func(function(evt) {
|
||||
assert_equals(evt.target, self);
|
||||
}), true);
|
||||
self.dispatchEvent(new Event("message"));
|
||||
}, "target");
|
||||
|
||||
done();
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
self.onmessage = 1;
|
||||
assert_equals(self.onmessage, null,
|
||||
"attribute should return null after being set to a primitive");
|
||||
}, "Setting onmessage to 1");
|
||||
|
||||
test(function() {
|
||||
var object = {
|
||||
handleEvent: this.unreached_func()
|
||||
};
|
||||
self.onmessage = object;
|
||||
assert_equals(self.onmessage, object,
|
||||
"attribute should return the object it was set to.");
|
||||
|
||||
self.dispatchEvent(new Event("message"));
|
||||
}, "Setting onmessage to an object");
|
||||
|
||||
test(function() {
|
||||
var triggered = false;
|
||||
var f = function(e) { triggered = true; };
|
||||
self.onmessage = f;
|
||||
assert_equals(self.onmessage, f,
|
||||
"attribute should return the function it was set to.");
|
||||
|
||||
self.dispatchEvent(new Event("message"));
|
||||
assert_true(triggered, "event handler should have been triggered");
|
||||
}, "Setting onmessage to a function");
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_not_equals(self.onmessage, null,
|
||||
"attribute should not return null after being set to a function");
|
||||
self.onmessage = 1;
|
||||
assert_equals(self.onmessage, null,
|
||||
"attribute should return null after being set to a primitive");
|
||||
}, "Setting onmessage to 1 (again)");
|
||||
|
||||
done();
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
postMessage(e.ports instanceof Array && e.ports.length === 0);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>e.ports in dedicated worker</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.postMessage(1);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
function processPixels(imagedata) {
|
||||
var pixeldata = imagedata.data;
|
||||
for (var i = 0; i < pixeldata.length; i = i+4) {
|
||||
pixeldata[i] = 128;
|
||||
}
|
||||
postMessage(imagedata);
|
||||
}
|
||||
processPixels(e.data[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>posting an imagedata (from a cloned canvas) in an array</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var canvas = document.createElement('canvas');
|
||||
var clone = canvas.cloneNode(true);
|
||||
var ctx = clone.getContext('2d');
|
||||
var imagedata = ctx.getImageData(0, 0, 300, 150);
|
||||
worker.postMessage([imagedata]);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
var pixeldata = e.data.data;
|
||||
for (var i = 0; i < pixeldata.length; i++) {
|
||||
assert_equals(pixeldata[i], (i % 4 == 0) ? 128 : 0);
|
||||
}
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>'message' event properties</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-dedicatedworkerglobalscope-postmessage">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test("Properties of the 'message' event").step(function() {
|
||||
var worker = new Worker("message-event.js");
|
||||
worker.onmessage = this.step_func_done(function (evt) {
|
||||
assert_class_string(evt, "MessageEvent");
|
||||
assert_equals(evt.type, "message");
|
||||
assert_false(evt.bubbles, "bubbles should be false");
|
||||
assert_false(evt.cancelable, "cancelable should be false");
|
||||
assert_equals(evt.data, "test");
|
||||
assert_equals(evt.origin, "", "origin");
|
||||
assert_equals(evt.lastEventId, "", "lastEventId");
|
||||
assert_equals(evt.source, null, "source");
|
||||
assert_array_equals(evt.ports, [], "ports");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
postMessage("test");
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
var rv = postMessage(1);
|
||||
assert_equals(rv, undefined);
|
||||
}, "return value of postMessage");
|
||||
|
||||
done();
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(false, [null]);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using [null] in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(1, null);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using null in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(1, undefined);
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using undefined in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!--
|
||||
var x = postMessage;
|
||||
postMessage = 1;
|
||||
x(postMessage == 1);
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting postMessage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
var imagedata = e.data;
|
||||
imagedata.data[0] = 128;
|
||||
postMessage(imagedata);
|
||||
}
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>structured clone of ImageData</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var imagedata = ctx.getImageData(0, 0, 300, 150);
|
||||
worker.postMessage(imagedata);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(''+e.data, '[object ImageData]');
|
||||
assert_equals(e.data.data[0], 128);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<!--
|
||||
var err = new Error('foo');
|
||||
var date = new Date();
|
||||
// commented out bits are either tested elsewhere or not supported yet. or uncloneable.
|
||||
var tests = [undefined, null, false, true, 1, NaN, Infinity, 'foo', date, /foo/, /* ImageData, File, FileData, FileList,*/ null/*self*/,
|
||||
[undefined, null, false, true, 1, NaN, Infinity, 'foo', /*date, /foo/,*/ null/*self*/, /*[], {},*/ null/*err*/],
|
||||
{a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', /*i:date, j:/foo/,*/ k:null/*self*/, /*l:[], m:{},*/ n:null/*err*/},
|
||||
null/*err*/];
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
try {
|
||||
postMessage(tests[i]);
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>structured clone of message</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var wrapper_test = async_test();
|
||||
var tests = [
|
||||
{test:async_test('undefined'), check:function(e) { assert_equals(e.data, undefined); }},
|
||||
{test:async_test('null'), check:function(e) { assert_equals(e.data, null); }},
|
||||
{test:async_test('false'), check:function(e) { assert_false(e.data); }},
|
||||
{test:async_test('true'), check:function(e) { assert_true(e.data); }},
|
||||
{test:async_test('1'), check:function(e) { assert_equals(e.data, 1); }},
|
||||
{test:async_test('NaN'), check:function(e) { assert_equals(e.data, NaN); }},
|
||||
{test:async_test('Infinity'), check:function(e) { assert_equals(e.data, Infinity); }},
|
||||
{test:async_test('string'), check:function(e) { assert_equals(e.data, 'foo'); }},
|
||||
{test:async_test('date'), check:function(e) { assert_equals(e.data instanceof Date, true); }},
|
||||
{test:async_test('regexp'), check:function(e) { assert_equals('' + e.data, '/foo/'); assert_equals(e.data instanceof RegExp, true, 'e.data instanceof RegExp'); }},
|
||||
{test:async_test('self'), check:function(e) { assert_equals(e.data, null); }},
|
||||
{test:async_test('array'), check:function(e) { assert_array_equals(e.data, [undefined, null, false, true, 1, NaN, Infinity, 'foo', null, null]); }},
|
||||
{test:async_test('object'), check:function(e) { assert_object_equals(e.data, {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', k:null, n:null}); }},
|
||||
{test:async_test('error'), check:function(e) { assert_equals(e.data, null, 'new Error()'); }},
|
||||
{test:wrapper_test, check:function(e) { assert_unreached(); }}
|
||||
];
|
||||
// make wrapper_test pass after 500ms
|
||||
setTimeout(tests[tests.length-1].test.step_func(function() {
|
||||
this.done();
|
||||
}), 500);
|
||||
|
||||
wrapper_test.step(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = function(e) {
|
||||
tests[i].test.step(function() { tests[i].check(e); this.done(); });
|
||||
i++;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
Loading…
Add table
Add a link
Reference in a new issue