зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d1a5149f5e9b (bug 1345490) for OSX, Windows and Linux stylo reftests and marionette failing with "No module named six.moves.urllib.parse". r=backout
--HG-- rename : testing/web-platform/tests/html/browsers/windows/resources/window-close-button.html => testing/web-platform/tests/html/browsers/windows/support-close.html rename : testing/web-platform/tests/html/browsers/windows/resources/noreferrer-window-name.html => testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html rename : testing/web-platform/tests/html/browsers/windows/resources/nested-post-to-opener.html => testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html rename : testing/web-platform/tests/html/browsers/windows/resources/window-opener.html => testing/web-platform/tests/html/browsers/windows/support-opener-null.html rename : testing/web-platform/tests/html/browsers/windows/resources/post-to-opener.html => testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html rename : testing/web-platform/tests/html/browsers/windows/resources/echo-window-name.html => testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html rename : testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end-manual.https.html => testing/web-platform/tests/mediacapture-streams/MediaStreamTrack-end.https.html rename : testing/web-platform/tests/notifications/shownotification-resolve-manual.https.html => testing/web-platform/tests/notifications/shownotification-resolve-manual.html rename : testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw-manual.https.html => testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw-manual.html rename : testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw.https.html => testing/web-platform/tests/service-workers/service-worker/fetch-event-within-sw.html rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/buildtests.py => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/buildtests.py rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/common.js => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/common.js rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/entities.dat => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/entities.dat rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/tags.dat => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tags.dat rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/timestamps.dat => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/timestamps.dat rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/dat/tree-building.dat => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/dat/tree-building.dat rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/entities.html => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/entities.html rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/tags.html => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tags.html rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/timestamps.html => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/timestamps.html rename : testing/web-platform/tests/webvtt/parsing/cue-text-parsing/tests/tree-building.html => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-cue-text-parsing-rules/tests/tree-building.html rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-bom.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-bom.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-formfeed.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-formfeed.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-lowercase.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-lowercase.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-no-newline.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-no-newline.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-null.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-null.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-space-no-newline.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-space-no-newline.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-space.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-space.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-tab-no-newline.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-tab-no-newline.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/tests/support/signature-tab.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-tab.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-partial.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-too-short.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-two-boms.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-two-boms.vtt rename : testing/web-platform/tests/webvtt/parsing/file-parsing/support/signature-websrt.vtt => testing/web-platform/tests/webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/signature-websrt.vtt
This commit is contained in:
Родитель
789828c3b2
Коммит
6b1edec6ea
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,2 +1,2 @@
|
|||
local: 5dc5249408ecc0003f0c68d32a8e782dec23fd36
|
||||
upstream: aef9b4f327326fd32420281f9bc1ca9b60d553b3
|
||||
local: ec3ef9f77a52693e9732ca480df16017af0d9504
|
||||
upstream: fc4da5233160c1ed5675ae4a7859552cb7e0349f
|
||||
|
|
|
@ -900,7 +900,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"html/semantics/forms/textfieldselection/selection-value-interactions.html": [
|
||||
"2083d78d4a6a7b48994f17909790dfeb1ac903ae",
|
||||
"6c5e95a8f2f11d106e669eb82b46ffff73d08335",
|
||||
"testharness"
|
||||
],
|
||||
"html/semantics/scripting-1/the-script-element/create-module-script.html": [
|
||||
|
|
|
@ -20,7 +20,7 @@ var t = async_test("drawImage() of an APNG with no poster frame draws the first
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
}), 500);
|
||||
|
|
|
@ -20,7 +20,7 @@ var t = async_test("drawImage() of an animated GIF draws the first frame");
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.gif'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
}), 500);
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#f00';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '67px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -27,7 +27,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '67px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -31,7 +31,7 @@ ctx.font = '67px CanvasTest';
|
|||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillText('AA', 0, 50);
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillText('AA', 0, 50);
|
||||
_assertPixelApprox(canvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -27,7 +27,7 @@ var t = async_test("");
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50");
|
||||
_assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100");
|
||||
|
|
|
@ -27,7 +27,7 @@ var t = async_test("The empty string has zero width");
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0");
|
||||
}), 500);
|
||||
|
|
|
@ -20,11 +20,11 @@ var t = async_test("createPattern() of an animated GIF draws the first frame");
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(function () {
|
||||
setTimeout(function () {
|
||||
var pattern = ctx.createPattern(document.getElementById('anim-gr.gif'), 'repeat');
|
||||
ctx.fillStyle = pattern;
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillRect(50, 0, 50, 50);
|
||||
_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -28,7 +28,7 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
|
|
@ -27,7 +27,7 @@ var t = async_test("Space characters are converted to U+0020 and collapsed (per
|
|||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
|
|
|
@ -3486,11 +3486,11 @@
|
|||
- anim-gr.gif
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(function () {
|
||||
setTimeout(function () {
|
||||
var pattern = ctx.createPattern(document.getElementById('anim-gr.gif'), 'repeat');
|
||||
ctx.fillStyle = pattern;
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillRect(50, 0, 50, 50);
|
||||
@assert pixel 25,25 ==~ 0,255,0,255;
|
||||
@assert pixel 75,25 ==~ 0,255,0,255;
|
||||
|
@ -9033,7 +9033,7 @@
|
|||
- anim-gr.gif
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.gif'), 0, 0);
|
||||
@assert pixel 50,25 ==~ 0,255,0,255;
|
||||
}), 500);
|
||||
|
@ -9047,7 +9047,7 @@
|
|||
- anim-gr.png
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.png'), 0, 0);
|
||||
@assert pixel 50,25 ==~ 0,255,0,255;
|
||||
}), 500);
|
||||
|
|
|
@ -418,7 +418,7 @@
|
|||
# Hanging baseline is 0.500em above alphabetic
|
||||
|
||||
# WebKit doesn't block onload on font loads, so we try to make it a bit more reliable
|
||||
# by waiting with step_timeout after load before drawing
|
||||
# by waiting with setTimeout after load before drawing
|
||||
|
||||
- name: 2d.text.draw.fill.maxWidth.fontface
|
||||
desc: fillText works on @font-face fonts
|
||||
|
@ -429,7 +429,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#f00';
|
||||
|
@ -450,7 +450,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -470,7 +470,7 @@
|
|||
code: |
|
||||
ctx.font = '67px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -496,7 +496,7 @@
|
|||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillText('AA', 0, 50);
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillText('AA', 0, 50);
|
||||
@assert pixel 5,5 ==~ 0,255,0,255;
|
||||
@assert pixel 95,5 ==~ 0,255,0,255;
|
||||
|
@ -515,7 +515,7 @@
|
|||
code: |
|
||||
ctx.font = '67px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -536,7 +536,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -560,7 +560,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -584,7 +584,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -607,7 +607,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -630,7 +630,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -653,7 +653,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -677,7 +677,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -701,7 +701,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -726,7 +726,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -752,7 +752,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -777,7 +777,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -803,7 +803,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -827,7 +827,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -852,7 +852,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -871,7 +871,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -890,7 +890,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -909,7 +909,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -928,7 +928,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -947,7 +947,7 @@
|
|||
code: |
|
||||
ctx.font = '50px CanvasTest';
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
|
@ -968,7 +968,7 @@
|
|||
- CanvasTest
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
@assert ctx.measureText('A').width === 50;
|
||||
@assert ctx.measureText('AA').width === 100;
|
||||
|
@ -986,7 +986,7 @@
|
|||
- CanvasTest
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
@assert ctx.measureText("").width === 0;
|
||||
}), 500);
|
||||
|
@ -999,7 +999,7 @@
|
|||
- CanvasTest
|
||||
code: |
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
@assert ctx.measureText('A B').width === 150;
|
||||
@assert ctx.measureText('A B').width === 150; @moz-todo
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
@zqzhang
|
||||
@zcorpan
|
||||
@jdm
|
||||
@Ms2ger
|
||||
@mkruisselbrink
|
||||
|
|
|
@ -17,22 +17,12 @@ async_test(function(t) {
|
|||
|
||||
xhr.send();
|
||||
|
||||
xhr.onload = t.step_func_done(function() {
|
||||
xhr.onload = t.step_func(function() {
|
||||
assert_equals(xhr.response, "test");
|
||||
t.done();
|
||||
})
|
||||
xhr.onerror = t.step_func(function() {
|
||||
assert_unreached("Got unexpected error event");
|
||||
})
|
||||
}, "Revoke blob URL after open(), will fetch");
|
||||
|
||||
async_test(t => {
|
||||
const blob = new Blob(["test"]),
|
||||
blobURL = URL.createObjectURL(blob),
|
||||
client = new XMLHttpRequest
|
||||
URL.revokeObjectURL(blobURL)
|
||||
client.open("GET", blobURL)
|
||||
client.onload = t.step_func(() => assert_unreached("Got unexpected load event"))
|
||||
client.onerror = t.step_func_done()
|
||||
client.send()
|
||||
}, "Revoke blob URL before open(), network error (after send())")
|
||||
</script>
|
||||
});
|
||||
</script>
|
|
@ -12,7 +12,7 @@ var db, open_rq = createdb(async_test(), undefined, 2);
|
|||
open_rq.onupgradeneeded = function(e) {
|
||||
db = e.target.result;
|
||||
assert_equals(db.version, 2);
|
||||
var transaction = e.target.transaction;
|
||||
transaction = e.target.transaction;
|
||||
transaction.oncomplete = fail(this, "unexpected transaction.complete");
|
||||
transaction.onabort = function(e) {
|
||||
assert_equals(e.target.db.version, 0);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
<script>
|
||||
|
||||
var db
|
||||
var open_rq = createdb(async_test())
|
||||
var sawTransactionComplete = false
|
||||
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Transaction active flag is set during event dispatch</title>
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-success-event">
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-error-event">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
const request = tx.objectStore('store').get(0);
|
||||
request.onerror = t.unreached_func('request should succeed');
|
||||
request.onsuccess = () => {
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active during success handler');
|
||||
|
||||
let saw_handler_promise = false;
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
saw_handler_promise = true;
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in handler\'s microtasks');
|
||||
}));
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_true(saw_handler_promise);
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
};
|
||||
},
|
||||
'Transactions are active during success handlers');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
const request = tx.objectStore('store').get(0);
|
||||
request.onerror = t.unreached_func('request should succeed');
|
||||
request.addEventListener('success', () => {
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active during success listener');
|
||||
|
||||
let saw_listener_promise = false;
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
saw_listener_promise = true;
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in listener\'s microtasks');
|
||||
}));
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_true(saw_listener_promise);
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
});
|
||||
},
|
||||
'Transactions are active during success listeners');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
tx.objectStore('store').put(0, 0);
|
||||
const request = tx.objectStore('store').add(0, 0);
|
||||
request.onsuccess = t.unreached_func('request should fail');
|
||||
request.onerror = e => {
|
||||
e.preventDefault();
|
||||
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active during error handler');
|
||||
|
||||
let saw_handler_promise = false;
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
saw_handler_promise = true;
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in handler\'s microtasks');
|
||||
}));
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_true(saw_handler_promise);
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
};
|
||||
},
|
||||
'Transactions are active during error handlers');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
tx.objectStore('store').put(0, 0);
|
||||
const request = tx.objectStore('store').add(0, 0);
|
||||
request.onsuccess = t.unreached_func('request should fail');
|
||||
request.addEventListener('error', e => {
|
||||
e.preventDefault();
|
||||
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active during error listener');
|
||||
|
||||
let saw_listener_promise = false;
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
saw_listener_promise = true;
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in listener\'s microtasks');
|
||||
}));
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_true(saw_listener_promise);
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
});
|
||||
},
|
||||
'Transactions are active during error listeners');
|
||||
|
||||
</script>
|
|
@ -1,205 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Fire error event - Exception thrown</title>
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-error-event">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
|
||||
function fire_error_event_test(func, description) {
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('s');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('s', 'readwrite');
|
||||
tx.oncomplete = t.unreached_func('transaction should abort');
|
||||
const store = tx.objectStore('s');
|
||||
store.put(0, 0);
|
||||
const request = store.add(0, 0);
|
||||
request.onsuccess = t.unreached_func('request should fail');
|
||||
func(t, db, tx, request);
|
||||
},
|
||||
description);
|
||||
}
|
||||
|
||||
// Listeners on the request.
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
request.onerror = () => {
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on request');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
request.onerror = e => {
|
||||
e.preventDefault();
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on request, with preventDefault');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
request.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event listener on request');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
request.addEventListener('error', () => {
|
||||
// no-op
|
||||
});
|
||||
request.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in second error event listener on request');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
let second_listener_called = false;
|
||||
request.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
request.addEventListener('error', t.step_func(() => {
|
||||
second_listener_called = true;
|
||||
assert_true(is_transaction_active(tx, 's'),
|
||||
'Transaction should be active until dispatch completes');
|
||||
}));
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_true(second_listener_called);
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in first error event listener on request, ' +
|
||||
'transaction active in second');
|
||||
|
||||
// Listeners on the transaction.
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
tx.onerror = () => {
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on transaction');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
tx.onerror = e => {
|
||||
e.preventDefault();
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on transaction, with preventDefault');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
tx.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event listener on transaction');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
tx.addEventListener('error', () => {
|
||||
// no-op
|
||||
});
|
||||
tx.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in second error event listener on transaction');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
let second_listener_called = false;
|
||||
tx.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.addEventListener('error', t.step_func(() => {
|
||||
second_listener_called = true;
|
||||
assert_true(is_transaction_active(tx, 's'),
|
||||
'Transaction should be active until dispatch completes');
|
||||
}));
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_true(second_listener_called);
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in first error event listener on transaction, ' +
|
||||
'transaction active in second');
|
||||
|
||||
// Listeners on the connection.
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
db.onerror = () => {
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on connection');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
db.onerror = e => {
|
||||
e.preventDefault()
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event handler on connection, with preventDefault');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
db.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in error event listener on connection');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
db.addEventListener('error', () => {
|
||||
// no-op
|
||||
});
|
||||
db.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in second error event listener on connection');
|
||||
|
||||
fire_error_event_test((t, db, tx, request) => {
|
||||
let second_listener_called = false;
|
||||
db.addEventListener('error', () => {
|
||||
throw Error();
|
||||
});
|
||||
db.addEventListener('error', t.step_func(() => {
|
||||
second_listener_called = true;
|
||||
assert_true(is_transaction_active(tx, 's'),
|
||||
'Transaction should be active until dispatch completes');
|
||||
}));
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_true(second_listener_called);
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in first error event listener on connection, ' +
|
||||
'transaction active in second');
|
||||
|
||||
</script>
|
|
@ -1,72 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Fire success event - Exception thrown</title>
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-success-event">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
|
||||
function fire_success_event_test(func, description) {
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('s');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('s');
|
||||
tx.oncomplete = t.unreached_func('transaction should abort');
|
||||
const store = tx.objectStore('s');
|
||||
const request = store.get(0);
|
||||
func(t, db, tx, request);
|
||||
},
|
||||
description);
|
||||
}
|
||||
|
||||
fire_success_event_test((t, db, tx, request) => {
|
||||
request.onsuccess = () => {
|
||||
throw Error();
|
||||
};
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in success event handler on request');
|
||||
|
||||
fire_success_event_test((t, db, tx, request) => {
|
||||
request.addEventListener('success', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in success event listener on request');
|
||||
|
||||
fire_success_event_test((t, db, tx, request) => {
|
||||
request.addEventListener('success', () => {
|
||||
// no-op
|
||||
});
|
||||
request.addEventListener('success', () => {
|
||||
throw Error();
|
||||
});
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in second success event listener on request');
|
||||
|
||||
fire_success_event_test((t, db, tx, request) => {
|
||||
let second_listener_called = false;
|
||||
request.addEventListener('success', () => {
|
||||
throw Error();
|
||||
});
|
||||
request.addEventListener('success', t.step_func(() => {
|
||||
second_listener_called = true;
|
||||
assert_true(is_transaction_active(tx, 's'),
|
||||
'Transaction should be active until dispatch completes');
|
||||
}));
|
||||
tx.onabort = t.step_func_done(() => {
|
||||
assert_true(second_listener_called);
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in first success event listener, tx active in second');
|
||||
|
||||
</script>
|
|
@ -1,77 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Fire upgradeneeded event - Exception thrown</title>
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#fire-a-version-change-event">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true});
|
||||
|
||||
function fire_upgradeneeded_event_test(func, description) {
|
||||
async_test(t => {
|
||||
const dbname = document.location + '-' + t.name;
|
||||
const del = indexedDB.deleteDatabase(dbname);
|
||||
del.onerror = t.unreached_func('deleteDatabase should succeed');
|
||||
const open = indexedDB.open(dbname, 1);
|
||||
open.onsuccess = t.unreached_func('open should fail');
|
||||
func(t, open);
|
||||
}, description);
|
||||
}
|
||||
|
||||
fire_upgradeneeded_event_test((t, open) => {
|
||||
let tx;
|
||||
open.onupgradeneeded = () => {
|
||||
tx = open.transaction;
|
||||
throw Error();
|
||||
};
|
||||
open.onerror = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in upgradeneeded handler');
|
||||
|
||||
fire_upgradeneeded_event_test((t, open) => {
|
||||
let tx;
|
||||
open.addEventListener('upgradeneeded', () => {
|
||||
tx = open.transaction;
|
||||
throw Error();
|
||||
});
|
||||
open.onerror = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in upgradeneeded listener');
|
||||
|
||||
fire_upgradeneeded_event_test((t, open) => {
|
||||
let tx;
|
||||
open.addEventListener('upgradeneeded', () => {
|
||||
// No-op.
|
||||
});
|
||||
open.addEventListener('upgradeneeded', () => {
|
||||
tx = open.transaction;
|
||||
throw Error();
|
||||
});
|
||||
open.onerror = t.step_func_done(() => {
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in second upgradeneeded listener');
|
||||
|
||||
fire_upgradeneeded_event_test((t, open) => {
|
||||
let tx;
|
||||
let second_listener_called = false;
|
||||
open.addEventListener('upgradeneeded', () => {
|
||||
open.result.createObjectStore('s');
|
||||
throw Error();
|
||||
});
|
||||
open.addEventListener('upgradeneeded', t.step_func(() => {
|
||||
second_listener_called = true;
|
||||
tx = open.transaction;
|
||||
assert_true(is_transaction_active(tx, 's'),
|
||||
'Transaction should be active until dispatch completes');
|
||||
}));
|
||||
open.onerror = t.step_func_done(() => {
|
||||
assert_true(second_listener_called);
|
||||
assert_equals(tx.error.name, 'AbortError');
|
||||
});
|
||||
}, 'Exception in first upgradeneeded listener, tx active in second');
|
||||
|
||||
</script>
|
|
@ -25,7 +25,7 @@
|
|||
var store = db.transaction("test")
|
||||
.objectStore("test");
|
||||
|
||||
var cursor_rq = store.openCursor();
|
||||
cursor_rq = store.openCursor();
|
||||
cursor_rq.onsuccess = t.step_func(function(e) {
|
||||
var cursor = e.target.result;
|
||||
if (!cursor) {
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>IDBFactory.deleteDatabase() and opaque origins</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
|
||||
function load_iframe(src, sandbox) {
|
||||
return new Promise(resolve => {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.onload = () => { resolve(iframe); };
|
||||
if (sandbox)
|
||||
iframe.sandbox = sandbox;
|
||||
iframe.srcdoc = src;
|
||||
iframe.style.display = 'none';
|
||||
document.documentElement.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
function wait_for_message(iframe) {
|
||||
return new Promise(resolve => {
|
||||
self.addEventListener('message', function listener(e) {
|
||||
if (e.source === iframe.contentWindow) {
|
||||
resolve(e.data);
|
||||
self.removeEventListener('message', listener);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const script =
|
||||
'<script>' +
|
||||
' window.onmessage = () => {' +
|
||||
' try {' +
|
||||
' const r = indexedDB.deleteDatabase("opaque-origin-test");' +
|
||||
' window.parent.postMessage({result: "no exception"}, "*");' +
|
||||
' } catch (ex) {' +
|
||||
' window.parent.postMessage({result: ex.name}, "*");' +
|
||||
' };' +
|
||||
' };' +
|
||||
'<\/script>';
|
||||
|
||||
promise_test(t => {
|
||||
return load_iframe(script)
|
||||
.then(iframe => {
|
||||
iframe.contentWindow.postMessage({}, '*');
|
||||
return wait_for_message(iframe);
|
||||
})
|
||||
.then(message => {
|
||||
assert_equals(message.result, 'no exception',
|
||||
'IDBFactory.deleteDatabase() should not throw');
|
||||
});
|
||||
}, 'IDBFactory.deleteDatabase() in non-sandboxed iframe should not throw');
|
||||
|
||||
promise_test(t => {
|
||||
return load_iframe(script, 'allow-scripts')
|
||||
.then(iframe => {
|
||||
iframe.contentWindow.postMessage({}, '*');
|
||||
return wait_for_message(iframe);
|
||||
})
|
||||
.then(message => {
|
||||
assert_equals(message.result, 'SecurityError',
|
||||
'Exception should be SecurityError');
|
||||
});
|
||||
}, 'IDBFactory.deleteDatabase() in sandboxed iframe should throw SecurityError');
|
||||
</script>
|
|
@ -1,68 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>IDBFactory.open() and opaque origins</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
|
||||
function load_iframe(src, sandbox) {
|
||||
return new Promise(resolve => {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.onload = () => { resolve(iframe); };
|
||||
if (sandbox)
|
||||
iframe.sandbox = sandbox;
|
||||
iframe.srcdoc = src;
|
||||
iframe.style.display = 'none';
|
||||
document.documentElement.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
function wait_for_message(iframe) {
|
||||
return new Promise(resolve => {
|
||||
self.addEventListener('message', function listener(e) {
|
||||
if (e.source === iframe.contentWindow) {
|
||||
resolve(e.data);
|
||||
self.removeEventListener('message', listener);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const script =
|
||||
'<script>' +
|
||||
' window.onmessage = () => {' +
|
||||
' try {' +
|
||||
' indexedDB.deleteDatabase("opaque-origin-test");' +
|
||||
' const r = indexedDB.open("opaque-origin-test");' +
|
||||
' r.onupgradeneeded = () => { r.transaction.abort(); };' +
|
||||
' window.parent.postMessage({result: "no exception"}, "*");' +
|
||||
' } catch (ex) {' +
|
||||
' window.parent.postMessage({result: ex.name}, "*");' +
|
||||
' };' +
|
||||
' };' +
|
||||
'<\/script>';
|
||||
|
||||
promise_test(t => {
|
||||
return load_iframe(script)
|
||||
.then(iframe => {
|
||||
iframe.contentWindow.postMessage({}, '*');
|
||||
return wait_for_message(iframe);
|
||||
})
|
||||
.then(message => {
|
||||
assert_equals(message.result, 'no exception',
|
||||
'IDBFactory.open() should not throw');
|
||||
});
|
||||
}, 'IDBFactory.open() in non-sandboxed iframe should not throw');
|
||||
|
||||
promise_test(t => {
|
||||
return load_iframe(script, 'allow-scripts')
|
||||
.then(iframe => {
|
||||
iframe.contentWindow.postMessage({}, '*');
|
||||
return wait_for_message(iframe);
|
||||
})
|
||||
.then(message => {
|
||||
assert_equals(message.result, 'SecurityError',
|
||||
'Exception should be SecurityError');
|
||||
});
|
||||
}, 'IDBFactory.open() in sandboxed iframe should throw SecurityError');
|
||||
</script>
|
|
@ -12,7 +12,6 @@
|
|||
var t = async_test("Delete an existing database");
|
||||
|
||||
t.step(function() {
|
||||
var db;
|
||||
var openrq = indexedDB.open('db', 3);
|
||||
|
||||
openrq.onupgradeneeded = function(e) {
|
||||
|
@ -26,7 +25,7 @@
|
|||
db.onerror = fail(t, "db.error");
|
||||
db.abort = fail(t, "db.abort");
|
||||
|
||||
step_timeout(t.step_func(Second), 4);
|
||||
setTimeout(t.step_func(Second), 4);
|
||||
db.close();
|
||||
});
|
||||
|
||||
|
@ -45,8 +44,8 @@
|
|||
deleterq.onupgradeneeded = fail(t, "delete.upgradeneeded");
|
||||
}
|
||||
|
||||
async_test("Delete a nonexistent database").step(function(e) {
|
||||
var deleterq = indexedDB.deleteDatabase('nonexistent');
|
||||
async_test("Delete a nonexistant database").step(function(e) {
|
||||
var deleterq = indexedDB.deleteDatabase('nonexistant');
|
||||
|
||||
deleterq.onsuccess = this.step_func(function(e) { this.done(); });
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="support.js"></script>
|
||||
|
||||
<script>
|
||||
var db, index,
|
||||
var db,
|
||||
t = async_test(),
|
||||
record = { key: 1, indexedProperty: "data" };
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
assert_equals(e.target.result.key, 4);
|
||||
assert_equals(e.target.result.indexedProperty, 'data4');
|
||||
|
||||
step_timeout(function() { t.done(); }, 4)
|
||||
setTimeout(function() { t.done(); }, 4)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
rq.onsuccess = t.step_func(function(e) {
|
||||
assert_equals(e.target.result, 4);
|
||||
|
||||
step_timeout(function() { t.done(); }, 4)
|
||||
setTimeout(function() { t.done(); }, 4)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
open_rq.onsuccess = function (event) {
|
||||
var txn = db.transaction("store", "readwrite");
|
||||
var ostore = txn.objectStore("store");
|
||||
ostore = txn.objectStore("store");
|
||||
t.step(function(){
|
||||
assert_throws("InvalidStateError", function(){
|
||||
ostore.createIndex("index", "indexedProperty");
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
.get(1);
|
||||
rq.onsuccess = t.step_func(function(e) {
|
||||
assert_equals(e.target.results, undefined);
|
||||
step_timeout(function() { t.done(); }, 10);
|
||||
setTimeout(function() { t.done(); }, 10);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Key Generator behavior with explicit keys generator overflow</title>
|
||||
<link rel=help href="https://w3c.github.io/IndexedDB/#key-generator-construct">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support.js"></script>
|
||||
<script>
|
||||
|
||||
function big_key_test(key, description) {
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
assert_equals(indexedDB.cmp(key, key), 0, 'Key is valid');
|
||||
|
||||
db.createObjectStore('store', {autoIncrement: true});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
const store = tx.objectStore('store');
|
||||
const value = 0;
|
||||
let request;
|
||||
|
||||
request = store.put(value);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 1,
|
||||
'Key generator should initially be 1');
|
||||
});
|
||||
|
||||
request = store.put(value);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 2,
|
||||
'Key generator should increment');
|
||||
});
|
||||
|
||||
request = store.put(value, 1000);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 1000,
|
||||
'Explicit key should be used');
|
||||
});
|
||||
|
||||
request = store.put(value);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 1001,
|
||||
'Key generator should have updated');
|
||||
});
|
||||
|
||||
request = store.put(value, key);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, key,
|
||||
'Explicit key should be used');
|
||||
});
|
||||
|
||||
if (key >= 0) {
|
||||
// Large positive values will max out the key generator, so it
|
||||
// can no longer produce keys.
|
||||
request = store.put(value);
|
||||
request.onsuccess = t.unreached_func('put should fail');
|
||||
request.onerror = t.step_func(e => {
|
||||
e.preventDefault();
|
||||
assert_equals(e.target.error.name, 'ConstraintError',
|
||||
'Key generator should have returned failure');
|
||||
});
|
||||
} else {
|
||||
// Large negative values are always lower than the key generator's
|
||||
// current number, so have no effect on the generator.
|
||||
request = store.put(value);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 1002,
|
||||
'Key generator should have updated');
|
||||
});
|
||||
}
|
||||
|
||||
request = store.put(value, 2000);
|
||||
request.onerror = t.unreached_func('put should succeed');
|
||||
request.onsuccess = t.step_func(e => {
|
||||
assert_equals(e.target.result, 2000,
|
||||
'Explicit key should be used');
|
||||
});
|
||||
|
||||
tx.onabort = t.step_func(() => {
|
||||
assert_unreached(`Transaction aborted: ${tx.error.message}`);
|
||||
});
|
||||
tx.oncomplete = t.step_func(() => { t.done(); });
|
||||
},
|
||||
description);
|
||||
}
|
||||
|
||||
[
|
||||
{
|
||||
key: Number.MAX_SAFE_INTEGER + 1,
|
||||
description: '53 bits'
|
||||
},
|
||||
{
|
||||
key: Math.pow(2, 60),
|
||||
description: 'greater than 53 bits, less than 64 bits'
|
||||
},
|
||||
{
|
||||
key: -Math.pow(2, 60),
|
||||
description: 'greater than 53 bits, less than 64 bits (negative)'
|
||||
},
|
||||
{
|
||||
key: Math.pow(2, 63),
|
||||
description: '63 bits'
|
||||
},
|
||||
{
|
||||
key: -Math.pow(2, 63),
|
||||
description: '63 bits (negative)'
|
||||
},
|
||||
{
|
||||
key: Math.pow(2, 64),
|
||||
description: '64 bits'
|
||||
},
|
||||
{
|
||||
key: -Math.pow(2, 64),
|
||||
description: '64 bits (negative)'
|
||||
},
|
||||
{
|
||||
key: Math.pow(2, 70),
|
||||
description: 'greater than 64 bits, but still finite'
|
||||
},
|
||||
{
|
||||
key: -Math.pow(2, 70),
|
||||
description: 'greater than 64 bits, but still finite (negative)'
|
||||
},
|
||||
{
|
||||
key: Infinity,
|
||||
description: 'equal to Infinity'
|
||||
},
|
||||
{
|
||||
key: -Infinity,
|
||||
description: 'equal to -Infinity'
|
||||
}
|
||||
].forEach(function(testCase) {
|
||||
big_key_test(testCase.key,
|
||||
`Key generator vs. explicit key ${testCase.description}`);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
|
@ -1,119 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Key Generator behavior with explicit keys and value injection</title>
|
||||
<link rel=help href="https://w3c.github.io/IndexedDB/#inject-key-into-value">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support.js"></script>
|
||||
<script>
|
||||
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'id'});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
t.onabort = t.unreached_func('transaction should not abort');
|
||||
|
||||
const store = tx.objectStore('store');
|
||||
|
||||
store.put({name: 'n'}).onsuccess = t.step_func(e => {
|
||||
const key = e.target.result;
|
||||
assert_equals(key, 1, 'Key generator initial value should be 1');
|
||||
store.get(key).onsuccess = t.step_func(e => {
|
||||
const value = e.target.result;
|
||||
assert_equals(typeof value, 'object', 'Result should be object');
|
||||
assert_equals(value.name, 'n', 'Result should have name property');
|
||||
assert_equals(value.id, key, 'Key should be injected');
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
},
|
||||
'Key is injected into value - single segment path');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'a.b.id'});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
t.onabort = t.unreached_func('transaction should not abort');
|
||||
|
||||
const store = tx.objectStore('store');
|
||||
|
||||
store.put({name: 'n'}).onsuccess = t.step_func(e => {
|
||||
const key = e.target.result;
|
||||
assert_equals(key, 1, 'Key generator initial value should be 1');
|
||||
store.get(key).onsuccess = t.step_func(e => {
|
||||
const value = e.target.result;
|
||||
assert_equals(typeof value, 'object', 'Result should be object');
|
||||
assert_equals(value.name, 'n', 'Result should have name property');
|
||||
assert_equals(value.a.b.id, key, 'Key should be injected');
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
},
|
||||
'Key is injected into value - multi-segment path');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'a.b.id'});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
t.onabort = t.unreached_func('transaction should not abort');
|
||||
|
||||
const store = tx.objectStore('store');
|
||||
|
||||
store.put({name: 'n1', b: {name: 'n2'}}).onsuccess = t.step_func(e => {
|
||||
const key = e.target.result;
|
||||
assert_equals(key, 1, 'Key generator initial value should be 1');
|
||||
store.get(key).onsuccess = t.step_func(e => {
|
||||
const value = e.target.result;
|
||||
assert_equals(typeof value, 'object', 'Result should be object');
|
||||
assert_equals(value.name, 'n1', 'Result should have name property');
|
||||
assert_equals(value.b.name, 'n2', 'Result should have name property');
|
||||
assert_equals(value.a.b.id, key, 'Key should be injected');
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
},
|
||||
'Key is injected into value - multi-segment path, partially populated');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'id'});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
const store = tx.objectStore('store');
|
||||
|
||||
assert_throws('DataError', () => {
|
||||
store.put(123);
|
||||
}, 'Key path should be checked against value');
|
||||
|
||||
t.done();
|
||||
},
|
||||
'put() throws if key cannot be injected - single segment path');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db) => {
|
||||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'a.b.id'});
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store', 'readwrite');
|
||||
const store = tx.objectStore('store');
|
||||
|
||||
assert_throws('DataError', () => {
|
||||
store.put({a: 123});
|
||||
}, 'Key path should be checked against value');
|
||||
|
||||
assert_throws('DataError', () => {
|
||||
store.put({a: {b: 123} });
|
||||
}, 'Key path should be checked against value');
|
||||
|
||||
t.done();
|
||||
},
|
||||
'put() throws if key cannot be injected - multi-segment path');
|
||||
|
||||
</script>
|
|
@ -24,7 +24,7 @@
|
|||
db.createObjectStore(store_name, { keyPath: keypath })
|
||||
}, "createObjectStore with keyPath");
|
||||
|
||||
var store = db.createObjectStore(store_name);
|
||||
store = db.createObjectStore(store_name);
|
||||
assert_throws('SyntaxError', function() {
|
||||
store.createIndex('index', keypath);
|
||||
}, "createIndex with keyPath");
|
||||
|
|
|
@ -50,7 +50,7 @@ function createdb_for_multiple_tests(dbname, version) {
|
|||
function auto_fail(evt, current_test) {
|
||||
/* Fail handlers, if we haven't set on/whatever/, don't
|
||||
* expect to get event whatever. */
|
||||
rq_open.manually_handled = {};
|
||||
rq_open.manually_handled = {}
|
||||
|
||||
rq_open.addEventListener(evt, function(e) {
|
||||
if (current_test !== test) {
|
||||
|
@ -71,15 +71,15 @@ function createdb_for_multiple_tests(dbname, version) {
|
|||
this.db.onversionchange =
|
||||
fail(test, 'unexpected db.versionchange');
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
rq_open.__defineSetter__("on" + evt, function(h) {
|
||||
rq_open.manually_handled[evt] = true;
|
||||
if (!h)
|
||||
rq_open.addEventListener(evt, function() {});
|
||||
else
|
||||
rq_open.addEventListener(evt, test.step_func(h));
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// add a .setTest method to the IDBOpenDBRequest object
|
||||
|
@ -123,10 +123,6 @@ function indexeddb_test(upgrade_func, open_func, description, options) {
|
|||
});
|
||||
open.onsuccess = t.step_func(function() {
|
||||
var db = open.result;
|
||||
t.add_cleanup(function() {
|
||||
db.close();
|
||||
indexedDB.deleteDatabase(db.name);
|
||||
});
|
||||
if (open_func)
|
||||
open_func(t, db);
|
||||
});
|
||||
|
@ -147,44 +143,3 @@ function expect(t, expected) {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Checks to see if the passed transaction is active (by making
|
||||
// requests against the named store).
|
||||
function is_transaction_active(tx, store_name) {
|
||||
try {
|
||||
const request = tx.objectStore(store_name).get(0);
|
||||
request.onerror = e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
return true;
|
||||
} catch (ex) {
|
||||
assert_equals(ex.name, 'TransactionInactiveError',
|
||||
'Active check should either not throw anything, or throw ' +
|
||||
'TransactionInactiveError');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Keep the passed transaction alive indefinitely (by making requests
|
||||
// against the named store). Returns a function to to let the
|
||||
// transaction finish, and asserts that the transaction is not yet
|
||||
// finished.
|
||||
function keep_alive(tx, store_name) {
|
||||
let completed = false;
|
||||
tx.addEventListener('complete', () => { completed = true; });
|
||||
|
||||
let pin = true;
|
||||
|
||||
function spin() {
|
||||
if (!pin)
|
||||
return;
|
||||
tx.objectStore(store_name).get(0).onsuccess = spin;
|
||||
}
|
||||
spin();
|
||||
|
||||
return () => {
|
||||
assert_false(completed, 'Transaction completed while kept alive');
|
||||
pin = false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Transactions deactivation timing</title>
|
||||
<link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-transaction">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
},
|
||||
'New transactions are deactivated before next task');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
const tx = db.transaction('store');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in microtask checkpoint');
|
||||
release_tx();
|
||||
t.done();
|
||||
}));
|
||||
},
|
||||
'New transactions are not deactivated until after the microtask checkpoint');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
let tx, release_tx;
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
tx = db.transaction('store');
|
||||
release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
}));
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
t.done();
|
||||
}), 0);
|
||||
},
|
||||
'New transactions from microtask are deactivated before next task');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
let tx, release_tx;
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
tx = db.transaction('store');
|
||||
release_tx = keep_alive(tx, 'store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
}));
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in microtask checkpoint');
|
||||
release_tx();
|
||||
t.done();
|
||||
}));
|
||||
},
|
||||
'New transactions from microtask are still active through the ' +
|
||||
'microtask checkpoint');
|
||||
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
},
|
||||
(t, db) => {
|
||||
// This transaction serves as the source of an event seen by multiple
|
||||
// listeners. A DOM event with multiple listeners could be used instead,
|
||||
// but not via dispatchEvent() because (drumroll...) that happens
|
||||
// synchronously so microtasks don't run between steps.
|
||||
const tx = db.transaction('store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active after creation');
|
||||
|
||||
const request = tx.objectStore('store').get(0);
|
||||
let new_tx;
|
||||
let first_listener_ran = false;
|
||||
let microtasks_ran = false;
|
||||
request.addEventListener('success', t.step_func(() => {
|
||||
first_listener_ran = true;
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in callback');
|
||||
|
||||
// We check to see if this transaction is active across unrelated event
|
||||
// dispatch steps.
|
||||
new_tx = db.transaction('store');
|
||||
assert_true(is_transaction_active(new_tx, 'store'),
|
||||
'New transaction should be active after creation');
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
microtasks_ran = true;
|
||||
assert_true(is_transaction_active(new_tx, 'store'),
|
||||
'New transaction is still active in microtask checkpoint');
|
||||
}));
|
||||
|
||||
}));
|
||||
request.addEventListener('success', t.step_func(() => {
|
||||
assert_true(first_listener_ran, 'first listener ran first');
|
||||
assert_true(microtasks_ran, 'microtasks ran before second listener');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in callback');
|
||||
assert_false(is_transaction_active(new_tx, 'store'),
|
||||
'New transaction should be inactive in unrelated callback');
|
||||
t.done();
|
||||
}));
|
||||
},
|
||||
'Deactivation of new transactions happens at end of invocation');
|
||||
|
||||
</script>
|
|
@ -41,7 +41,7 @@
|
|||
db.onerror = fail(t, "db.error");
|
||||
db.abort = fail(t, "db.abort");
|
||||
|
||||
step_timeout(t.step_func(OpenSecond), 10);
|
||||
setTimeout(t.step_func(OpenSecond), 10);
|
||||
});
|
||||
|
||||
// Errors
|
||||
|
@ -91,7 +91,7 @@
|
|||
"open2.success",
|
||||
]);
|
||||
|
||||
step_timeout(function() { t.done(); }, 10);
|
||||
setTimeout(function() { t.done(); }, 10);
|
||||
});
|
||||
|
||||
// Errors
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
db.onerror = fail(t, "db.error");
|
||||
db.abort = fail(t, "db.abort");
|
||||
|
||||
step_timeout(t.step_func(OpenSecond), 10);
|
||||
setTimeout(t.step_func(OpenSecond), 10);
|
||||
});
|
||||
|
||||
// Errors
|
||||
|
@ -83,7 +83,7 @@
|
|||
"open2.success",
|
||||
]);
|
||||
|
||||
step_timeout(function() { t.done(); }, 10);
|
||||
setTimeout(function() { t.done(); }, 10);
|
||||
});
|
||||
|
||||
// Errors
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Upgrade transaction deactivation timing</title>
|
||||
<link rel="help" href="http://localhost:4201/#upgrade-transaction-steps">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=support.js></script>
|
||||
<script>
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in upgradeneeded callback');
|
||||
},
|
||||
(t, db) => { t.done(); },
|
||||
'Upgrade transactions are active in upgradeneeded callback');
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in upgradeneeded callback');
|
||||
|
||||
Promise.resolve().then(t.step_func(() => {
|
||||
assert_true(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be active in microtask checkpoint');
|
||||
}));
|
||||
},
|
||||
(t, db) => { t.done(); },
|
||||
'Upgrade transactions are active in upgradeneeded callback and microtasks');
|
||||
|
||||
|
||||
indexeddb_test(
|
||||
(t, db, tx) => {
|
||||
db.createObjectStore('store');
|
||||
const release_tx = keep_alive(tx, 'store');
|
||||
|
||||
setTimeout(t.step_func(() => {
|
||||
assert_false(is_transaction_active(tx, 'store'),
|
||||
'Transaction should be inactive in next task');
|
||||
release_tx();
|
||||
}), 0);
|
||||
},
|
||||
(t, db) => { t.done(); },
|
||||
'Upgrade transactions are deactivated before next task');
|
||||
|
||||
</script>
|
|
@ -81,7 +81,7 @@
|
|||
});
|
||||
|
||||
if (read_success_count < RQ_COUNT + 5)
|
||||
step_timeout(this.step_func(loop), write_request_count ? 1000 : 100);
|
||||
setTimeout(this.step_func(loop), write_request_count ? 1000 : 100);
|
||||
else
|
||||
// This is merely a "nice" hack to run finish after the last request is done
|
||||
db.transaction("s")
|
||||
|
@ -89,7 +89,7 @@
|
|||
.count()
|
||||
.onsuccess = this.step_func(function()
|
||||
{
|
||||
step_timeout(this.step_func(finish), 100);
|
||||
setTimeout(this.step_func(finish), 100);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@Wafflespeanut
|
||||
@Ms2ger
|
||||
@jimsch
|
||||
@engelke
|
||||
|
|
|
@ -8,5 +8,4 @@
|
|||
@mathiasbynens
|
||||
@ronkorving
|
||||
@jdm
|
||||
@annevk
|
||||
@wisniewskit
|
||||
@Ms2ger
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
Tests for the [XMLHttpRequest Standard](https://xhr.spec.whatwg.org/).
|
||||
|
||||
More XMLHttpRequest-related tests can be found in
|
||||
|
||||
* /cors
|
||||
* /fetch
|
||||
* /url (failure.html in particular)
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
assert_equals(client.readyState, 0);
|
||||
|
||||
test.step_timeout(function(){ // use a timeout to catch any implementation that might queue an abort event for later - just in case
|
||||
test.done()
|
||||
setTimeout(function(){ // use a timeout to catch any implementation that might queue an abort event for later - just in case
|
||||
test.step(function(){test.done();});
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
});
|
||||
client.open("GET", "resources/delay.py?ms=3000", true);
|
||||
client.send(null);
|
||||
test.step_timeout(() => {
|
||||
assert_equals(abortFired, true);
|
||||
test.done();
|
||||
setTimeout(function(){
|
||||
test.step(function(){
|
||||
assert_equals(abortFired, true);
|
||||
test.done();
|
||||
});
|
||||
}, 200);
|
||||
window.stop();
|
||||
});
|
||||
|
|
|
@ -25,18 +25,20 @@
|
|||
|
||||
client.timeout = 100;
|
||||
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function() {
|
||||
assert_true(timeoutFired);
|
||||
|
||||
// abort should not cause the "abort" event to fire
|
||||
client.abort();
|
||||
|
||||
test.step_timeout(() => { // use a timeout to catch any implementation that might queue an abort event for later - just in case
|
||||
test.done()
|
||||
setTimeout(function(){ // use a timeout to catch any implementation that might queue an abort event for later - just in case
|
||||
test.step(function(){test.done();});
|
||||
}, 200);
|
||||
|
||||
assert_equals(client.readyState, 0);
|
||||
}, 300);
|
||||
|
||||
test.done();
|
||||
}), 300);
|
||||
|
||||
client.ontimeout = function () {
|
||||
timeoutFired = true;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
client.open("GET", "resources/inspect-headers.py?filter_name=cookie")
|
||||
client.onreadystatechange = test.step_func(function(){
|
||||
if(client.readyState === 4){
|
||||
assert_equals(client.responseText, 'Cookie: test=anonymous-mode-unsupported\n', 'The deprecated anonymous:true should be ignored, cookie sent anyway')
|
||||
assert_equals(client.responseText, 'cookie: test=anonymous-mode-unsupported\n', 'The deprecated anonymous:true should be ignored, cookie sent anyway')
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>XMLHttpRequest: data URLs</title>
|
||||
<title>XMLHttpRequest: data uri</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#data:-urls-and-http" data-tested-assertations="following::ul/li[1] following::ul/li[2] following::ul/li[4]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ul/li[10]/dl/dt[2]" />
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
function do_test(method, url, mimeType, testNamePostfix) {
|
||||
if (typeof mimeType === 'undefined' || mimeType === null) mimeType = 'text/plain';
|
||||
var test = async_test("XHR method " + method + " with MIME type " + mimeType + (testNamePostfix||''));
|
||||
function do_test(method, uri, charset, testNamePostfix) {
|
||||
if (typeof charset === 'undefined' || charset === null) charset = 'text/plain';
|
||||
var test = async_test("XHR method " + method + " with charset " + charset+(testNamePostfix||''));
|
||||
test.step(function() {
|
||||
var client = new XMLHttpRequest();
|
||||
client.onreadystatechange = test.step_func(function () {
|
||||
|
@ -16,15 +18,25 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Note: fetching a data URL with a non-GET method returns a network
|
||||
// error per <http://fetch.spec.whatwg.org/#basic-fetch>.
|
||||
if (method.toUpperCase() !== 'GET') {
|
||||
assert_equals(client.status, 0);
|
||||
assert_equals(client.responseText, '');
|
||||
assert_equals(client.statusText, '');
|
||||
test.done();
|
||||
return;
|
||||
}
|
||||
|
||||
assert_equals(client.responseText, "Hello, World!");
|
||||
assert_equals(client.status, 200);
|
||||
assert_equals(client.getResponseHeader('Content-Type'), mimeType);
|
||||
assert_equals(client.getResponseHeader('Content-Type'), charset);
|
||||
var allHeaders = client.getAllResponseHeaders();
|
||||
assert_regexp_match(allHeaders, /content\-type\:/i, 'getAllResponseHeaders() includes Content-Type');
|
||||
assert_false(/content\-length\:/i.test(allHeaders), 'getAllResponseHeaders() must not include Content-Length');
|
||||
test.done();
|
||||
});
|
||||
client.open(method, url);
|
||||
client.open(method, uri);
|
||||
client.send(null);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
client.open("GET", "resources/well-formed.xml");
|
||||
client.send(null);
|
||||
client.abort();
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function () {
|
||||
assert_unreached("onabort not called after 4 ms");
|
||||
}, 4);
|
||||
}), 4);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
<title>XMLHttpRequest: The send() method: Fire an event named load (synchronous flag is unset)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onload" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-load" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onload" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-load" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::a[contains(@href,'#switch-done')]/.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol/li[6]" />
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
|
@ -20,11 +22,11 @@
|
|||
client.onreadystatechange = test.step_func(function() {
|
||||
if (client.readyState !== 4) return;
|
||||
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function() {
|
||||
assert_unreached("Didn't get load event within 4ms of readystatechange==4");
|
||||
}, 4);
|
||||
}), 4);
|
||||
});
|
||||
client.open("GET", "resources/well-formed.xml");
|
||||
client.send(null);
|
||||
});
|
||||
</script>
|
||||
</script>
|
|
@ -6,6 +6,9 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadend" data-tested-assertations="/../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadend" data-tested-assertations="/../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="/following-sibling::ol/li[10]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::a[contains(@href,'#switch-done')]/.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::ol[1]/li[7]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
@ -20,9 +23,9 @@
|
|||
});
|
||||
client.onreadystatechange = function() {
|
||||
if (client.readyState !== 4) return;
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function() {
|
||||
assert_unreached("onloadend not called after 100 ms");
|
||||
}, 100);
|
||||
}), 100);
|
||||
};
|
||||
client.open("GET", "resources/well-formed.xml");
|
||||
client.send(null);
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang=en>
|
||||
<meta charset=utf-8>
|
||||
<title>XMLHttpRequest: The send() method: Fire a progress event named loadstart on upload object (synchronous flag is unset)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onprogress" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-progress" data-tested-assertations="../.." />
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test = async_test();
|
||||
test.step(function() {
|
||||
var client = new XMLHttpRequest();
|
||||
client.upload.onloadstart = test.step_func(function(e) {
|
||||
assert_true(e instanceof ProgressEvent);
|
||||
assert_equals(e.total, 7, 'upload.onloadstart: event.total');
|
||||
assert_equals(e.loaded, 0, 'upload.onloadstart: event.loaded');
|
||||
assert_equals(e.type, "loadstart");
|
||||
test.done();
|
||||
});
|
||||
client.onreadystatechange = test.step_func(function() {
|
||||
if (client.readyState === 4)
|
||||
assert_unreached("onloadstart not called.");
|
||||
});
|
||||
client.open("POST", "resources/trickle.py?ms=5&count=8");
|
||||
client.send('foo=bar');
|
||||
});
|
||||
</script>
|
|
@ -20,9 +20,9 @@
|
|||
assert_equals(client.readyState, 1);
|
||||
test.done();
|
||||
});
|
||||
test.step_timeout(function () {
|
||||
setTimeout(test.step_func(function () {
|
||||
assert_unreached("onloadstart not called after 500 ms");
|
||||
}, 500);
|
||||
}), 500);
|
||||
client.open("GET", "resources/well-formed.xml");
|
||||
client.send(null);
|
||||
});
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onprogress" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-progress" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::*//a[contains(@href,'#make-progress-notifications')]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#make-progress-notifications" data-tested-assertations=".." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#switch-done" data-tested-assertations="following::li[5]" />
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test = async_test();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[10]/dt[1]">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[7] following::a[contains(@href,'#switch-loading')]/..">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#switch-loading" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]">
|
||||
</head>
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
xhr.timeout = 5;
|
||||
xhr.open("POST", "resources/delay.py?ms=20000");
|
||||
xhr.send("Test Message");
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function () {
|
||||
assert_unreached("ontimeout not called.");
|
||||
}, 10);
|
||||
}), 10);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
client.timeout = 5;
|
||||
client.open("GET", "resources/delay.py?ms=20000");
|
||||
client.send(null);
|
||||
test.step_timeout(() => {
|
||||
setTimeout(test.step_func(function () {
|
||||
assert_unreached("ontimeout not called.");
|
||||
}, 10);
|
||||
}), 10);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onprogress" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::*//a[contains(@href,'#make-upload-progress-notifications')] following::ol[1]/li[8]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#make-upload-progress-notifications" data-tested-assertations=".. ../following::ul/li[1]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-upload" data-tested-assertations=".." />
|
||||
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onprogress" data-tested-assertations="../.." />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::*//a[contains(@href,'#make-upload-progress-notifications')] following::ol[1]/li[8]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#make-upload-progress-notifications" data-tested-assertations=".. ../following::ul/li[1]" />
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-upload" data-tested-assertations=".." />
|
||||
|
||||
<div id="log"></div>
|
||||
|
@ -12,11 +14,7 @@
|
|||
var test = async_test();
|
||||
test.step(function() {
|
||||
var client = new XMLHttpRequest();
|
||||
client.upload.onprogress = test.step_func(function(e) {
|
||||
assert_true(e instanceof ProgressEvent);
|
||||
// This short payload will most likely be sent before the first progress evt
|
||||
assert_equals(e.loaded, 22);
|
||||
assert_equals(e.total, 22);
|
||||
client.upload.onprogress = test.step_func(function() {
|
||||
test.done();
|
||||
});
|
||||
client.onreadystatechange = test.step_func(function() {
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>Casing of known headers</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const client = new XMLHttpRequest
|
||||
client.open("GET", "resources/header-content-length.asis", false)
|
||||
client.send()
|
||||
assert_equals(client.getAllResponseHeaders(), "CONTENT-LENGTH: 0\r\n")
|
||||
})
|
||||
test(() => {
|
||||
const client = new XMLHttpRequest
|
||||
client.open("GET", "resources/echo-headers.py", false)
|
||||
client.setRequestHeader("THIS-IS-A-TEST", "1")
|
||||
client.setRequestHeader("THIS-is-A-test", "2")
|
||||
client.setRequestHeader("content-TYPE", "x/x")
|
||||
client.send()
|
||||
assert_regexp_match(client.responseText, /content-TYPE/)
|
||||
assert_regexp_match(client.responseText, /THIS-IS-A-TEST: 1,/)
|
||||
})
|
||||
promise_test(() => {
|
||||
return fetch("resources/echo-headers.py", {headers: [["THIS-is-A-test", 1], ["THIS-IS-A-TEST", 2]] }).then(res => res.text()).then(body => {
|
||||
assert_regexp_match(body, /THIS-is-A-test: 1/)
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -1,24 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>XMLHttpRequest: getAllResponseHeaders()</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test((t) => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getAllResponseHeaders(), "foo-test: 1, 2, 3\r\n")
|
||||
})
|
||||
client.open("GET", "resources/headers-basic.asis")
|
||||
client.send(null)
|
||||
})
|
||||
|
||||
async_test((t) => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getAllResponseHeaders(), "also-here: Mr. PB\r\newok: lego\r\nfoo-test: 1, 2\r\n")
|
||||
})
|
||||
client.open("GET", "resources/headers.asis")
|
||||
client.send(null)
|
||||
})
|
||||
</script>
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: getResponseHeader() case-insensitive matching</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-getresponseheader">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-getresponseheader" data-tested-assertations="following::OL[1]/LI[4] following::OL[1]/LI[5] following::OL[1]/LI[6]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
@ -21,7 +21,7 @@
|
|||
assert_equals(client.getResponseHeader("X-custom-HEADER"), "test")
|
||||
assert_equals(client.getResponseHeader("X-CUSTOM-header-COMMA"), "1, 2")
|
||||
assert_equals(client.getResponseHeader("X-CUSTOM-no-such-header-in-response"), null)
|
||||
assert_equals(client.getResponseHeader("CONTENT-TYPE"), "text/plain")
|
||||
assert_true(client.getResponseHeader("CONTENT-TYPE").indexOf("text/plain") != -1)
|
||||
test.done()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>XMLHttpRequest: loadstart event corner cases</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest
|
||||
client.onloadstart = t.step_func(() => {
|
||||
assert_throws("InvalidStateError", () => client.setRequestHeader("General", "Organa"))
|
||||
assert_throws("InvalidStateError", () => client.withCredentials = true)
|
||||
assert_throws("InvalidStateError", () => client.send())
|
||||
client.onloadstart = null
|
||||
client.open("GET", "data:,BB-8")
|
||||
client.send()
|
||||
})
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.responseText, "BB-8")
|
||||
})
|
||||
client.open("GET", "data:,R2-D2")
|
||||
client.send()
|
||||
}, "open() during loadstart")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest
|
||||
let abortFired = false
|
||||
client.onloadstart = t.step_func_done(() => {
|
||||
assert_equals(client.readyState, 1)
|
||||
client.abort()
|
||||
assert_true(abortFired)
|
||||
assert_equals(client.readyState, 0)
|
||||
})
|
||||
client.onabort = t.step_func(() => {
|
||||
abortFired = true
|
||||
assert_equals(client.readyState, 4)
|
||||
})
|
||||
client.open("GET", "data:,K-2SO")
|
||||
client.send()
|
||||
}, "abort() during loadstart")
|
||||
</script>
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: open() after setRequestHeader()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol/li[14]/ul/li[4]" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: open() - value of Referer header</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="/following::ol[1]/li[2]/ol[1]/li[4]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
@ -13,7 +13,7 @@
|
|||
var client = new XMLHttpRequest()
|
||||
client.open("POST", "resources/inspect-headers.py?filter_name=referer", false)
|
||||
client.send(null)
|
||||
assert_equals(client.responseText, "Referer: "+location.href+'\n')
|
||||
assert_equals(client.responseText, "referer: "+location.href+'\n')
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>XMLHttpRequest: open() during abort()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
let result = [],
|
||||
client = new XMLHttpRequest(),
|
||||
expected = [1, 4, 1, 'hello']
|
||||
client.open("GET", "data:text/plain,")
|
||||
result.push(client.readyState)
|
||||
client.send()
|
||||
client.onreadystatechange = t.step_func(() => {
|
||||
client.onreadystatechange = null
|
||||
result.push(client.readyState)
|
||||
client.open("GET", "data:text/plain,hello")
|
||||
client.onload = t.step_func_done(() => {
|
||||
result.push(client.responseText)
|
||||
assert_array_equals(result, expected)
|
||||
})
|
||||
client.send()
|
||||
})
|
||||
client.abort()
|
||||
result.push(client.readyState) // surprise! should not be "unsent" even though we called abort()
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>XMLHttpRequest: open() - bogus URLs</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol/li[7] following::ol/li[8]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function url(url) {
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
assert_throws("SyntaxError", function() { client.open("GET", url) })
|
||||
}, document.title + " (" + url + ")")
|
||||
}
|
||||
url("//[")
|
||||
url("ftp:")
|
||||
url("http://a a/")
|
||||
url("http:////////////")
|
||||
url("http://u:p@/")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,65 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>XMLHttpRequest: overrideMimeType() and responseType = "blob"</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "")
|
||||
assert_equals(client.response.type, "text/xml")
|
||||
})
|
||||
client.open("GET", "resources/status.py")
|
||||
client.responseType = "blob"
|
||||
client.send()
|
||||
}, "Use text/xml as fallback MIME type")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "")
|
||||
assert_equals(client.response.type, "text/xml")
|
||||
})
|
||||
client.open("GET", "resources/status.py?content=thisshouldnotmakeadifferencebutdoes")
|
||||
client.responseType = "blob"
|
||||
client.send()
|
||||
}, "Use text/xml as fallback MIME type, 2")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "")
|
||||
assert_equals(client.response.type, "application/octet-stream")
|
||||
})
|
||||
client.open("GET", "resources/status.py")
|
||||
client.responseType = "blob"
|
||||
client.overrideMimeType("bogus")
|
||||
client.send()
|
||||
}, "Bogus MIME type should end up as application/octet-stream")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "")
|
||||
assert_equals(client.response.type, "application/octet-stream")
|
||||
})
|
||||
client.open("GET", "resources/status.py")
|
||||
client.responseType = "blob"
|
||||
client.overrideMimeType("text/xml;charset=†")
|
||||
client.send()
|
||||
}, "Bogus MIME type should end up as application/octet-stream, 2")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "")
|
||||
assert_equals(client.response.type, "hi/x")
|
||||
})
|
||||
client.open("GET", "resources/status.py")
|
||||
client.responseType = "blob"
|
||||
client.overrideMimeType("HI/x;test")
|
||||
client.send()
|
||||
}, "Valid MIME types need to be normalized")
|
||||
</script>
|
|
@ -1,41 +1,25 @@
|
|||
<!doctype html>
|
||||
<title>XMLHttpRequest: overrideMimeType() and invalid MIME types</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-overridemimetype()-method">
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.responseText, "ÿ")
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "text/html;charset=windows-1252")
|
||||
})
|
||||
client.open("GET", "resources/status.py?type=" + encodeURIComponent("text/html;charset=windows-1252") + "&content=%FF")
|
||||
client.overrideMimeType("bogus")
|
||||
client.send()
|
||||
}, "Bogus MIME type does not override encoding")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.responseText, "ÿ")
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "text/html;charset=windows-1252")
|
||||
})
|
||||
client.open("GET", "resources/status.py?type=" + encodeURIComponent("text/html;charset=windows-1252") + "&content=%FF")
|
||||
client.overrideMimeType("bogus;charset=Shift_JIS")
|
||||
client.send()
|
||||
}, "Bogus MIME type does not override encoding, 2")
|
||||
|
||||
async_test(t => {
|
||||
const client = new XMLHttpRequest()
|
||||
client.onload = t.step_func_done(() => {
|
||||
assert_equals(client.responseXML, null)
|
||||
assert_equals(client.getResponseHeader("Content-Type"), "text/xml")
|
||||
})
|
||||
client.open("GET", "resources/status.py?type=" + encodeURIComponent("text/xml") + "&content=" + encodeURIComponent("<x/>"))
|
||||
client.overrideMimeType("bogus")
|
||||
client.send()
|
||||
}, "Bogus MIME type does override MIME type")
|
||||
</script>
|
||||
<html>
|
||||
<head>
|
||||
<title>XMLHttpRequest: overrideMimeType() in unsent state, invalid MIME types</title>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-overridemimetype()-method" data-tested-assertations="/following::ol/li[2]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest();
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType('text\\plain;charset=Shift-JIS'); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType('text plain;charset=Shift-JIS'); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType('text\nplain;charset=Shift-JIS'); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType('cahrset=Shift-JIS'); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType(null); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType(50212); });
|
||||
assert_throws("SyntaxError", function() { client.overrideMimeType( (new Array(1000)).join('a/b/c/') ); });
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
client.onreadystatechange = function() {
|
||||
test.step(function() {
|
||||
if(client.readyState == 4) {
|
||||
assert_equals(client.responseText, 'User-Agent: '+navigator.userAgent+'\n')
|
||||
assert_equals(client.responseText, 'user-agent: '+navigator.userAgent+'\n')
|
||||
test.done()
|
||||
}
|
||||
})
|
||||
|
@ -29,7 +29,7 @@
|
|||
client.onreadystatechange = function() {
|
||||
test2.step(function() {
|
||||
if(client.readyState == 4) {
|
||||
assert_equals(client.responseText, 'User-Agent: TEST\n')
|
||||
assert_equals(client.responseText, 'user-agent: TEST\n')
|
||||
test2.done()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
Currently this testsuite tries to provide tests for XMLHttpRequest level 1.
|
||||
This test suite is not stable and is still under development. Tests may
|
||||
contain bugs and may change over time as a result of those bugs being fixed.
|
||||
|
||||
When more browsers implement XMLHttpRequest level 2 this testsuite will
|
||||
slowly evolve most likely.
|
||||
|
||||
http://dev.w3.org/2006/webapi/XMLHttpRequest/
|
||||
http://dev.w3.org/2006/webapi/XMLHttpRequest-2/
|
||||
|
||||
If the folders above give the status of the feature tested you can assume
|
||||
this is against level 1 unless explicitly stated otherwise.
|
||||
|
||||
NOTE: readyState and onreadystatechange are tested throughout the various
|
||||
tests. statusText is tested together with status.
|
||||
|
||||
NOTE: open-url-base* have absolute paths in them. They need to be adjusted
|
||||
on a per location basis.
|
||||
|
||||
NOTE: open-url-base-inserted-after-open.htm, open-url-base-inserted.htm,
|
||||
send-authentication.htm and open-url-base.htm refer to localhost.
|
||||
|
||||
|
||||
TESTS THAT ARE UNSTABLE AND (PROBABLY) NEED CHANGES
|
||||
responsexml-basic (see email WHATWG)
|
||||
send-authentication (see "user:password" debacle)
|
||||
|
||||
|
||||
TESTS NOT STARTED ON YET
|
||||
|
||||
<iframe> document.domain = w3.org create cross-origin xhr object
|
|
@ -1,6 +0,0 @@
|
|||
def main(request, response):
|
||||
response.writer.write_status(200)
|
||||
response.writer.write_header("Content-Type", "text/plain")
|
||||
response.writer.end_headers()
|
||||
response.writer.write(str(request.raw_headers))
|
||||
response.close_connection = True
|
|
@ -1,2 +0,0 @@
|
|||
HTTP/1.0 200 NANANA
|
||||
CONTENT-LENGTH: 0
|
|
@ -1,4 +0,0 @@
|
|||
HTTP/1.1 280 HELLO
|
||||
foo-test: 1
|
||||
foo-test: 2
|
||||
foo-test: 3
|
|
@ -1,5 +0,0 @@
|
|||
HTTP/1.1 200 YAYAYAYA
|
||||
foo-TEST: 1
|
||||
FOO-test: 2
|
||||
ALSO-here: Mr. PB
|
||||
ewok: lego
|
|
@ -1,21 +1,3 @@
|
|||
def get_response(raw_headers, filter_value, filter_name):
|
||||
result = ""
|
||||
for line in raw_headers.headers:
|
||||
if line[-2:] != '\r\n':
|
||||
return "Syntax error: missing CRLF: " + line
|
||||
line = line[:-2]
|
||||
|
||||
if ': ' not in line:
|
||||
return "Syntax error: no colon and space: " + line
|
||||
|
||||
name, value = line.split(': ', 1)
|
||||
if filter_value:
|
||||
if value == filter_value:
|
||||
result += name + ","
|
||||
elif name.lower() == filter_name:
|
||||
result += name + ": " + value + "\n";
|
||||
return result
|
||||
|
||||
def main(request, response):
|
||||
headers = []
|
||||
if "cors" in request.GET:
|
||||
|
@ -24,10 +6,17 @@ def main(request, response):
|
|||
headers.append(("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"))
|
||||
headers.append(("Access-Control-Allow-Headers", "x-test, x-foo"))
|
||||
headers.append(("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length"))
|
||||
headers.append(("content-type", "text/plain"))
|
||||
|
||||
filter_value = request.GET.first("filter_value", "")
|
||||
filter_name = request.GET.first("filter_name", "").lower()
|
||||
result = get_response(request.raw_headers, filter_value, filter_name)
|
||||
|
||||
result = ""
|
||||
for name, value in request.headers.iteritems():
|
||||
if filter_value:
|
||||
if value == filter_value:
|
||||
result += name.lower() + ","
|
||||
elif name.lower() == filter_name:
|
||||
result += name.lower() + ": " + value + "\n";
|
||||
|
||||
headers.append(("content-type", "text/plain"))
|
||||
return headers, result
|
||||
|
|
|
@ -18,14 +18,17 @@
|
|||
client.responseType = responseType
|
||||
}
|
||||
client.open("GET", "resources/status.py?content=" + input + "&type=" + encodeURIComponent(type), true)
|
||||
client.onload = test.step_func_done(() => {
|
||||
assert_equals(client.responseText, output)
|
||||
})
|
||||
client.onload = function(){
|
||||
test.step(function(){
|
||||
assert_equals(client.responseText, output)
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
client.send(null)
|
||||
})
|
||||
}
|
||||
request("application/xml", encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>")+'%FF'+encodeURIComponent("<\/x>"), "<?xml version='1.0' encoding='windows-1252'?><x>\u00FF<\/x>")
|
||||
request("text/html", encodeURIComponent("<!doctype html><meta charset=windows-1252>")+"%FF", "<!doctype html><meta charset=windows-1252>\uFFFD")
|
||||
request("text/html", encodeURIComponent("<!doctype html><meta charset=windows-1252>")+"%FF", "<!doctype html><meta charset=windows-1252>\u00FF")
|
||||
request("text/plain;charset=windows-1252", "%FF", "\u00FF")
|
||||
request("text/plain", "%FF", "\uFFFD")
|
||||
request("text/plain", "%FE%FF", "")
|
||||
|
@ -33,6 +36,8 @@
|
|||
request("text/plain", "%EF%BB%BF", "")
|
||||
request("text/plain", "%EF%BB%BF%EF%BB%BF", "\uFEFF")
|
||||
request("text/plain", "%C2", "\uFFFD")
|
||||
|
||||
// XXX might need fixing
|
||||
request("text/xml", "%FE%FF", "")
|
||||
request("text/xml", "%FE%FF%FE%FF", "\uFEFF")
|
||||
request("text/xml", "%EF%BB%BF", "")
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: send() - Accept-Language</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method">
|
||||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(text(),'Accept-Language')]/.. following::code[contains(text(),'Accept-Language')]/../following::ul[1]/li[1] following::code[contains(text(),'Accept-Language')]/../following::ul[1]/li[2]" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
@ -13,14 +13,14 @@
|
|||
var client = new XMLHttpRequest()
|
||||
client.open('GET', 'resources/inspect-headers.py?filter_name=accept-language', false)
|
||||
client.send(null)
|
||||
assert_regexp_match(client.responseText, /Accept-Language:\s.+/)
|
||||
assert_regexp_match(client.responseText, /accept-language:\s.+/)
|
||||
}, 'Send "sensible" default value, whatever that means')
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "resources/inspect-headers.py?filter_name=accept-language", false)
|
||||
client.setRequestHeader("Accept-Language", "x-GameSpeak")
|
||||
client.send(null)
|
||||
assert_equals(client.responseText, "Accept-Language: x-GameSpeak\n")
|
||||
assert_equals(client.responseText, "accept-language: x-GameSpeak\n")
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::ol[1]/li[3]"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<title>XMLHttpRequest: The send() method: FormData data</title>
|
||||
<title>XmlHttpRequest: The send() method: FormData data</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -22,13 +22,18 @@
|
|||
form.append("id", "0");
|
||||
form.append("value", "zero");
|
||||
|
||||
xhr.onreadystatechange = test.step_func(() => {
|
||||
if (xhr.readyState == 4) {
|
||||
assert_equals(xhr.status, 200);
|
||||
assert_equals(xhr.response, "id:0;value:zero;");
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
xhr.onreadystatechange = function()
|
||||
{
|
||||
test.step(function ()
|
||||
{
|
||||
if (xhr.readyState == 4)
|
||||
{
|
||||
assert_equals(xhr.status, 200);
|
||||
assert_equals(xhr.response, "id:0;value:zero;");
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
xhr.open("POST", "./resources/form.py", true);
|
||||
xhr.send(form);
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче