Bug 1245460 - Update web-platform-tests to revision af65262f5f3400024279c526117489f1f11d3233, a=testonly

This commit is contained in:
James Graham 2016-02-02 22:04:13 +00:00
parent 920f065175
commit a575521831
104 changed files with 1348 additions and 539 deletions

View File

@ -13583,6 +13583,10 @@
"path": "cssom-view/elementsFromPoint.html",
"url": "/cssom-view/elementsFromPoint.html"
},
{
"path": "cssom-view/negativeMargins.html",
"url": "/cssom-view/negativeMargins.html"
},
{
"path": "cssom-view/scrollingElement.html",
"url": "/cssom-view/scrollingElement.html"
@ -15627,6 +15631,18 @@
"path": "html/browsers/browsing-the-web/history-traversal/hashchange_event.html",
"url": "/html/browsers/browsing-the-web/history-traversal/hashchange_event.html"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html",
"url": "/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html",
"url": "/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html",
"url": "/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/popstate_event.html",
"url": "/html/browsers/browsing-the-web/history-traversal/popstate_event.html"
@ -19515,6 +19531,10 @@
"path": "html/webappapis/scripting/events/event-handler-javascript.html",
"url": "/html/webappapis/scripting/events/event-handler-javascript.html"
},
{
"path": "html/webappapis/scripting/events/event-handler-onresize.html",
"url": "/html/webappapis/scripting/events/event-handler-onresize.html"
},
{
"path": "html/webappapis/scripting/events/event-handler-spec-example.html",
"url": "/html/webappapis/scripting/events/event-handler-spec-example.html"
@ -31964,12 +31984,12 @@
"url": "/workers/interfaces/WorkerUtils/WindowTimers/004.html"
},
{
"path": "workers/interfaces/WorkerUtils/importScripts/001.html",
"url": "/workers/interfaces/WorkerUtils/importScripts/001.html"
"path": "workers/interfaces/WorkerUtils/importScripts/001.worker.js",
"url": "/workers/interfaces/WorkerUtils/importScripts/001.worker"
},
{
"path": "workers/interfaces/WorkerUtils/importScripts/002.html",
"url": "/workers/interfaces/WorkerUtils/importScripts/002.html"
"path": "workers/interfaces/WorkerUtils/importScripts/002.worker.js",
"url": "/workers/interfaces/WorkerUtils/importScripts/002.worker"
},
{
"path": "workers/interfaces/WorkerUtils/importScripts/003.html",
@ -32498,6 +32518,16 @@
"timeout": "long",
"url": "/eventsource/shared-worker/eventsource-constructor-non-same-origin.htm"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html",
"timeout": "long",
"url": "/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-cross-origin.html"
},
{
"path": "html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html",
"timeout": "long",
"url": "/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin.html"
},
{
"path": "html/browsers/browsing-the-web/scroll-to-fragid/007.html",
"timeout": "long",
@ -33428,6 +33458,11 @@
"timeout": "long",
"url": "/service-workers/cache-storage/serviceworker/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-matchAll.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/serviceworker/cache-matchAll.https.html"
},
{
"path": "service-workers/cache-storage/serviceworker/cache-put.https.html",
"timeout": "long",
@ -33463,6 +33498,11 @@
"timeout": "long",
"url": "/service-workers/cache-storage/window/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-matchAll.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/window/cache-matchAll.https.html"
},
{
"path": "service-workers/cache-storage/window/cache-put.https.html",
"timeout": "long",
@ -33503,6 +33543,11 @@
"timeout": "long",
"url": "/service-workers/cache-storage/worker/cache-match.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-matchAll.https.html",
"timeout": "long",
"url": "/service-workers/cache-storage/worker/cache-matchAll.https.html"
},
{
"path": "service-workers/cache-storage/worker/cache-put.https.html",
"timeout": "long",
@ -33713,16 +33758,7 @@
},
"local_changes": {
"deleted": [],
"items": {
"testharness": {
"cssom-view/negativeMargins.html": [
{
"path": "cssom-view/negativeMargins.html",
"url": "/cssom-view/negativeMargins.html"
}
]
}
},
"items": {},
"reftest_nodes": {}
},
"reftest_nodes": {
@ -39835,7 +39871,7 @@
}
]
},
"rev": "f3f87e1a2cc3845819038a8a6fe435bb6092e213",
"rev": "af65262f5f3400024279c526117489f1f11d3233",
"url_base": "/",
"version": 2
}

View File

@ -1 +1 @@
a035c3724da7e8235c26a3b6ea567365efda3b15
fa876a5774a3178efb42d6ebd8c8df045e03a80b

View File

@ -0,0 +1,3 @@
@jdm
@zqzhang
@Ms2ger

View File

@ -0,0 +1,6 @@
@inexorabletash
@plehegar
@zqzhang
@zcorpan
@jdm
@Ms2ger

View File

@ -0,0 +1,8 @@
@Velmont
@inexorabletash
@chunywang
@dumbmatter
@zqzhang
@yunxiaoxie
@zhaozihao
@foolip

View File

@ -0,0 +1,2 @@
@Wafflespeanut
@Ms2ger

View File

@ -0,0 +1,13 @@
@ecoal95
@hallvors
@kangxu
@caitp
@Manishearth
@plehegar
@foolip
@jungkees
@ibelem
@mathiasbynens
@ronkorving
@jdm
@Ms2ger

View File

@ -43,7 +43,7 @@
}
test(function() {
assert_true((new Date(client.getResponseHeader('Last-Modified'))).getTime() == (new Date(client.responseXML.lastModified)).getTime(), 'responseXML.lastModified time shoud be equal to time in response Last-Modified header')
assert_true((new Date(client.getResponseHeader('Last-Modified'))).getTime() == (new Date(client.responseXML.lastModified)).getTime(), 'responseXML.lastModified time should be equal to time in response Last-Modified header')
}, 'lastModified set according to HTTP header')
test(function() {

View File

@ -0,0 +1,3 @@
@zqzhang
@Volker-E
@dontcallmedom

View File

@ -0,0 +1 @@
@happyoungj

View File

@ -0,0 +1,4 @@
@zqzhang
@foolip
@dontcallmedom
@deniak

View File

@ -0,0 +1 @@
@sideshowbarker

View File

@ -0,0 +1,2 @@
@sideshowbarker
@hillbrad

View File

@ -0,0 +1,5 @@
@sideshowbarker
@zqzhang
@Velmont
@hillbrad
@jdm

View File

@ -0,0 +1 @@
@AutomatedTester

View File

@ -0,0 +1,3 @@
@deepak-sa
@sgrekhov
@alsemenov

View File

@ -0,0 +1,4 @@
@sideshowbarker
@dontcallmedom
@zcorpan
@Ms2ger

View File

@ -0,0 +1,6 @@
@ayg
@jdm
@Ms2ger
@plehegar
@zcorpan
@zqzhang

View File

@ -0,0 +1,5 @@
@sideshowbarker
@ChrisParis
@deniak
@jdm
@Ms2ger

View File

@ -0,0 +1,3 @@
@gsnedders
@zqzhang
@deniak

View File

@ -0,0 +1 @@
@ayg

View File

@ -0,0 +1,2 @@
@inexorabletash
@sideshowbarker

View File

@ -0,0 +1,5 @@
@zqzhang
@sideshowbarker
@deniak
@Velmont
@Yaffle

View File

@ -0,0 +1,2 @@
@jdm
@youennf

View File

@ -0,0 +1 @@
@luser

View File

@ -0,0 +1,2 @@
@zqzhang
@jdm

View File

@ -0,0 +1,2 @@
@plehegar
@foolip

View File

@ -0,0 +1 @@
@omo

View File

@ -0,0 +1,2 @@
@chaals
@cptvitamin

View File

@ -0,0 +1,2 @@
@haoxli
@zqzhang

View File

@ -1,5 +1,6 @@
@Ms2ger
@gsnedders
@jdm
@jgraham
@plehegar
@sideshowbarker

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<style>
body {
height: 2000px;
width: 2000px;
}
</style>
<body> Blank 1 </body>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<style>
body {
height: 2000px;
width: 2000px;
}
</style>
<body> Blank 2 </body>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
body {
height: 2000px;
width: 2000px;
}
#fragment {
position: absolute;
top: 800px;
background-color: #faa;
display: block;
height: 100px;
width: 100px;
}
</style>
<body>
Page with fragment
<a id="fragment" name="fragment" class='box'></a>
</body>

View File

@ -0,0 +1,34 @@
<!doctype html>
<title>Verify existence and basic read/write function of history.scrollRestoration</title>
<style>
body {
height: 2000px;
width: 2000px;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
test(function() {
assert_equals(history.scrollRestoration, 'auto');
}, 'Default value is "auto"');
test(function() {
history.scrollRestoration = 'manual';
assert_equals(history.scrollRestoration, 'manual', 'should be able to set "manual"');
history.scrollRestoration = 'auto';
assert_equals(history.scrollRestoration, 'auto', 'should be able to set "auto"');
}, 'It is writable');
test(function() {
history.scrollRestoration = 'auto';
for (var v of [3.1415, {}, 'bogus']) {
history.scrollRestoration = v;
assert_equals(history.scrollRestoration, 'auto', `setting to invalid value (${v}) should be ignored`);
}
}, 'Invalid values are ignored');
</script>

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<meta name=timeout content=long>
<title>Precedence of scroll restoration mode over fragment scrolling in cross-origin history traversal</title>
<style>
iframe {
height: 300px;
width: 300px;
}
</style>
<body>
<iframe></iframe>
</body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
// The test does the following navigation steps for iframe
// 1. load page-with-fragment.html#fragment
// 2. load blank1
// 3. go back to page-with-fragment.html
async_test(function(t) {
var iframe = document.querySelector('iframe');
var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
var steps = [
function() {
iframe.src = 'resources/page-with-fragment.html#fragment';
}, function() {
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be on page-with-fragment page');
// wait one animation frame to ensure layout is run and fragment scrolling is complete
iframe.contentWindow.requestAnimationFrame(function() {
assert_equals(iframe.contentWindow.scrollY, 800, 'should scroll to fragment');
iframe.contentWindow.history.scrollRestoration = 'manual';
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
setTimeout(next, 0);
});
}, function() {
// navigate to a new page from a different origin
iframe.src = iframe.src.replace("http://", "http://www.").replace("page-with-fragment.html#fragment", "blank1.html");
}, function() {
// going back causes the iframe to traverse back
history.back();
}, function() {
// coming back from history, scrollRestoration should be set to manual and respected
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be back on page-with-fragment page');
iframe.contentWindow.requestAnimationFrame(function() {
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
assert_equals(iframe.contentWindow.scrollX, 0, 'should not scroll to fragment');
assert_equals(iframe.contentWindow.scrollY, 0, 'should not scroll to fragment');
t.done();
});
}
];
var stepCount = 0;
var next = t.step_func(function() {
steps[stepCount++]();
});
iframe.onload = next;
next();
}, 'Manual scroll restoration should take precedent over scrolling to fragment in cross origin navigation');
</script>

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<style>
body {
height: 2000px;
width: 2000px;
}
#fragment {
position: absolute;
top: 800px;
background-color: #faa;
display: block;
height: 100px;
width: 100px;
}
</style>
<body>
<a id="fragment" name="fragment" class='box'></a>
</body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
async_test(function(t) {
history.scrollRestoration = 'manual';
assert_equals(history.scrollRestoration, 'manual');
location.hash = '#fragment';
assert_equals(window.scrollY, 800, 'new navigations should scroll to fragment');
// create a new entry and reset the scroll before verification
history.pushState(null, null, '#done');
window.scrollTo(0, 0);
assert_equals(window.scrollY, 0, 'should reset scroll before verification');
setTimeout(function() {
// setup verification
window.addEventListener('hashchange', t.step_func(function() {
assert_equals(location.hash, '#fragment');
assert_equals(history.scrollRestoration, 'manual');
// navigating back should give precedent to history restoration which is 'manual'
assert_equals(window.scrollX, 0, 'should not scroll to fragment');
assert_equals(window.scrollY, 0, 'should not scroll to fragment');
t.done();
}));
// kick off verification
window.history.back();
}, 0);
}, 'Manual scroll restoration should take precedent over scrolling to fragment in cross doc navigation');
</script>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<meta name=timeout content=long>
<title>Correct behaviour of scroll restoration mode is cross origin history traversal</title>
<style>
iframe {
height: 300px;
width: 300px;
}
</style>
<body>
<iframe></iframe>
</body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
// The test does the following navigation steps for iframe
// 1. load blank1
// 2. load blank2
// 3. go back to blank1
async_test(function(t) {
var iframe = document.querySelector('iframe');
var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
var steps = [
function() {
iframe.src = 'resources/blank1.html';
},
function() {
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be on first blank page');
iframe.contentWindow.history.scrollRestoration = 'manual';
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
iframe.contentWindow.scrollTo(500, 500);
assert_equals(iframe.contentWindow.scrollX, 500, 'scripted scrolling should take effect');
assert_equals(iframe.contentWindow.scrollY, 500, 'scripted scrolling should take effect');
setTimeout(next, 0);
},
function() {
// navigate to new page
iframe.src = 'resources/blank2.html';
},
function() {
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank2.html', 'should be on second blank page');
assert_equals(iframe.contentWindow.history.scrollRestoration, 'auto', 'new page loads should set scrollRestoration to "auto"');
setTimeout(next, 0);
}, function() {
iframe.contentWindow.history.back();
}, function() {
// coming back scrollRestoration should be restored to 'manual' and respected
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be back on first blank page');
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
assert_equals(iframe.contentWindow.scrollX, 0, 'horizontal scroll offset should not be restored');
assert_equals(iframe.contentWindow.scrollY, 0, 'vertical scroll offset should not be restored');
t.done();
}
];
var stepCount = 0;
var next = t.step_func(function() {
steps[stepCount++]();
});
iframe.onload = next;
next();
}, 'Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode');
</script>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<title>Correct behaviour of scroll restoration mode in same document history traversals</title>
<style>
body {
height: 10000px;
width: 10000px;
}
</style>
<body></body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
async_test(function(t) {
history.scrollRestoration = 'auto';
window.scrollTo(0, 0);
// create history entries and then verify the impact of scrollRestoration
// when they are popped
var entries = {
/* For scroll restoration mode 'auto', the spec does not require scroll
position to be restored at any particular value. */
'#1': {type: 'push', expectedScroll: null, scrollRestoration: 'auto'},
'#2': {type: 'replace', expectedScroll: null, scrollRestoration: 'auto'},
/* For scroll restoration mode 'manual', the spec requires scroll position
not to be restored. So we expect [555,555] which is the latest position
before navigation. */
'#3': {type: 'push', expectedScroll: [555, 555], scrollRestoration: 'manual'},
'#4': {type: 'replace', expectedScroll: [555, 555], scrollRestoration: 'manual'}
};
// setup entries
for (var key in entries) {
var entry = entries[key],
beforeValue = history.scrollRestoration,
newValue = entry.scrollRestoration;
var args = [{key: key}, '', key];
if (entry.type == 'push') {
history.pushState.apply(history, args);
} else {
history.pushState(null, '', key);
history.replaceState.apply(history, args);
}
assert_equals(history.scrollRestoration, beforeValue, `history.scrollRestoration value is retained after pushing new state`);
history.scrollRestoration = newValue;
assert_equals(history.scrollRestoration, newValue, `Setting scrollRestoration to ${newValue} works as expected`);
window.scrollBy(50, 100);
}
// setup verification
window.addEventListener('hashchange', t.step_func(function() {
var key = location.hash,
entry = entries[key];
if (key === '') {
t.done();
return;
}
assert_equals(history.state.key, key, `state should have key: ${key}`);
assert_equals(history.scrollRestoration, entry.scrollRestoration, 'scrollRestoration is updated correctly');
if (entry.expectedScroll) {
assert_equals(window.scrollX, entry.expectedScroll[0], `scrollX is correct for ${key}`);
assert_equals(window.scrollY, entry.expectedScroll[1], `scrollY is correct for ${key}`);
}
window.history.back();
}));
// reset the scroll and kick off the verification
setTimeout(function() {
history.pushState(null, null, '#done');
window.scrollTo(555, 555);
window.history.back();
}, 0);
}, 'history.{push,replace}State retain scroll restoration mode and navigation in the same document respects it');
</script>

View File

@ -2309,8 +2309,11 @@ interface BarProp {
attribute boolean visible;
};
enum ScrollRestoration { "auto", "manual" };
interface History {
readonly attribute long length;
attribute ScrollRestoration scrollRestoration;
readonly attribute any state;
void go(optional long delta);
void back();

View File

@ -19,7 +19,7 @@
<li class="upper-roman">fifth item</li>
<li class="disc">sixth item</li>
<li class="circle">seventh item</li>
<li class="square">eigth item</li>
<li class="square">eighth item</li>
<li class="none">ninth item</li>
<ol>
<li class="decimal">first ordered item</li>
@ -29,7 +29,7 @@
<li class="upper-roman">fifth ordered item</li>
<li class="disc">sixth ordered item</li>
<li class="circle">seventh ordered item</li>
<li class="square">eigth ordered item</li>
<li class="square">eighth ordered item</li>
<li class="none">ninth ordered item</li>
</ol>
<ul>
@ -40,6 +40,6 @@
<li class="upper-roman">fifth unordered item</li>
<li class="disc">sixth unordered item</li>
<li class="circle">seventh unordered item</li>
<li class="square">eigth unordered item</li>
<li class="square">eighth unordered item</li>
<li class="none">ninth unordered item</li>
</ul>

View File

@ -9,7 +9,7 @@
<li type=I>fifth item</li>
<li type=disc>sixth item</li>
<li type=circle>seventh item</li>
<li type=square>eigth item</li>
<li type=square>eighth item</li>
<li type=none>ninth item</li>
<ol>
<li type=1>first ordered item</li>
@ -19,7 +19,7 @@
<li type=I>fifth ordered item</li>
<li type=disc>sixth ordered item</li>
<li type=circle>seventh ordered item</li>
<li type=square>eigth ordered item</li>
<li type=square>eighth ordered item</li>
<li type=none>ninth ordered item</li>
</ol>
<ul>
@ -30,6 +30,6 @@
<li type=I>fifth unordered item</li>
<li type=disc>sixth unordered item</li>
<li type=circle>seventh unordered item</li>
<li type=square>eigth unordered item</li>
<li type=square>eighth unordered item</li>
<li type=none>ninth unordered item</li>
</ul>

View File

@ -12,7 +12,7 @@
<li type="I">fifth item</li>
<li type="disc">sixth item</li>
<li type="circle">seventh item</li>
<li type="square">eigth item</li>
<li type="square">eighth item</li>
<li type="none">ninth item</li>
<ol>
<li type="1">first ordered item</li>
@ -22,7 +22,7 @@
<li type="I">fifth ordered item</li>
<li type="disc">sixth ordered item</li>
<li type="circle">seventh ordered item</li>
<li type="square">eigth ordered item</li>
<li type="square">eighth ordered item</li>
<li type="none">ninth ordered item</li>
</ol>
<ul>
@ -33,7 +33,7 @@
<li type="I">fifth unordered item</li>
<li type="disc">sixth unordered item</li>
<li type="circle">seventh unordered item</li>
<li type="square">eigth unordered item</li>
<li type="square">eighth unordered item</li>
<li type="none">ninth unordered item</li>
</ul>
</body>

View File

@ -3,13 +3,15 @@
<title>HTML Test: The embed element represents a document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="stylesheet" href="/resources/testharness.css">
<meta name="assert" content="Check if the embed element represents a document when a text/html resource source is used">
<body>
<script type="application/javascript">
var childLoaded = false;
t = async_test("Test document type embedding");
addEventListener("load", t.step_func_done(function() { assert_true(childLoaded); }));
window.childLoaded = false;
async_test(function() {
addEventListener("load", this.step_func_done(function() {
assert_true(window.childLoaded);
}));
}, "Test document type embedding");
</script>
<embed src="embed-iframe.html">
</body>

View File

@ -23,25 +23,25 @@ var btn = document.getElementById("btn"),
document.forms.fm1.onsubmit = t1.step_func(function (evt) {
evt.preventDefault();
assert_true(evt.isTrusted, "The isTrusted attribute of the submit event shoud be true.");
assert_true(evt.bubbles, "The bubbles attribute of the submit event shoud be true.");
assert_true(evt.cancelable, "The cancelable attribute of the submit event shoud be true.");
assert_true(evt.isTrusted, "The isTrusted attribute of the submit event should be true.");
assert_true(evt.bubbles, "The bubbles attribute of the submit event should be true.");
assert_true(evt.cancelable, "The cancelable attribute of the submit event should be true.");
assert_true(evt instanceof Event, "The submit event is an instance of Event interface.");
t1.done();
});
document.forms.fm1.onreset = t2.step_func(function (evt) {
assert_true(evt.isTrusted, "The isTrusted attribute of the reset event shoud be true.");
assert_true(evt.bubbles, "The bubbles attribute of the reset event shoud be true.");
assert_true(evt.cancelable, "The cancelable attribute of the reset event shoud be true.");
assert_true(evt.isTrusted, "The isTrusted attribute of the reset event should be true.");
assert_true(evt.bubbles, "The bubbles attribute of the reset event should be true.");
assert_true(evt.cancelable, "The cancelable attribute of the reset event should be true.");
assert_true(evt instanceof Event, "The reset event is an instance of Event interface.");
t2.done();
});
document.getElementById("menu").onshow = t3.step_func(function (evt) {
assert_true(evt.isTrusted, "The isTrusted attribute of the show event shoud be true.");
assert_true(evt.isTrusted, "The isTrusted attribute of the show event should be true.");
assert_equals(evt.relatedTarget, menu_btn, "The relatedTarget attribute should be initialized to the related button element.");
assert_true(evt.cancelable, "The cancelable attribute of the show event shoud be true.");
assert_true(evt.cancelable, "The cancelable attribute of the show event should be true.");
assert_true(evt instanceof RelatedEvent, "The show event is an instance of RelatedEvent interface.");
t3.done();
});

View File

@ -2,7 +2,8 @@
<meta charset=utf-8>
<title>input type checkbox</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox)">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox)">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#run-synthetic-click-activation-steps">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
@ -19,28 +20,39 @@
checkbox4 = document.getElementById('checkbox4'),
checkbox5 = document.getElementById('checkbox5'),
checkbox6 = document.getElementById('checkbox6'),
c1_input_fired = false, c1_change_fired = false,
t1 = async_test("click on mutable checkbox fires the input and change events"),
c1_click_fired = false,
c1_input_fired = false,
c1_change_fired = false,
t1 = async_test("click on mutable checkbox fires a click event, then an input event, then a change event"),
t2 = async_test("click on non-mutable checkbox doesn't fire the input or change event"),
t3 = async_test("pre-activation steps on unchecked checkbox"),
t4 = async_test("pre-activation steps on checked checkbox"),
t5 = async_test("canceled activation steps on unchecked checkbox"),
t6 = async_test("canceled activation steps on unchecked checkbox (indeterminate=true in onclick)");
checkbox1.oninput= t1.step_func(function(e) {
checkbox1.onclick = t1.step_func(function () {
c1_click_fired = true;
assert_false(c1_input_fired, "click event should fire before input event");
assert_false(c1_change_fired, "click event should fire before change event");
});
checkbox1.oninput = t1.step_func(function(e) {
c1_input_fired = true;
assert_true(c1_click_fired, "input event should fire after click event");
assert_false(c1_change_fired, "input event should fire before change event");
assert_true(e.bubbles, "event should bubble");
assert_true(e.isTrusted, "event should be trusted");
assert_false(e.cancelable, "event shoud not be cancelable");
assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");
});
checkbox1.onchange = t1.step_func(function(e) {
c1_change_fired = true;
assert_true(c1_click_fired, "change event should fire after click event");
assert_true(c1_input_fired, "change event should fire after input event");
assert_true(e.bubbles, "event should bubble")
assert_true(e.isTrusted, "event should be trusted");
assert_false(e.cancelable, "event shoud not be cancelable");
assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");
});
@ -83,9 +95,22 @@
checkbox5.onclick = t5.step_func(function(e) {
e.preventDefault();
assert_false(checkbox5.checked);
/*
The prevention of the click doesn't have an effect until after all the
click event handlers have been run.
*/
assert_true(checkbox5.checked);
assert_false(checkbox5.indeterminate);
t5.done();
window.setTimeout(t5.step_func(function(e) {
/*
The click event has finished being dispatched, so the checkedness and
determinateness have been toggled back by now because the event
was preventDefault-ed.
*/
assert_false(checkbox5.checked);
assert_false(checkbox5.indeterminate);
t5.done();
}), 0);
});
t5.step(function(){
@ -97,9 +122,22 @@
checkbox6.onclick = t6.step_func(function(e) {
checkbox6.indeterminate = true;
e.preventDefault();
assert_false(checkbox6.checked);
assert_false(checkbox6.indeterminate);
t6.done();
/*
The prevention of the click doesn't have an effect until after all the
click event handlers have been run.
*/
assert_true(checkbox6.checked);
assert_true(checkbox6.indeterminate);
window.setTimeout(t6.step_func(function(e) {
/*
The click event has finished being dispatched, so the checkedness and
determinateness have been toggled back by now because the event
was preventDefault-ed.
*/
assert_false(checkbox6.checked);
assert_false(checkbox6.indeterminate);
t6.done();
}), 0);
});
t6.step(function(){

View File

@ -18,12 +18,12 @@
document.getElementById('file').oninput = t1.step_func_done(function(e) {
assert_true(e.bubbles, "input event bubbles");
assert_true(e.isTrusted, "input event should be trusted");
assert_false(e.cancelable, "input event shoud not be cancelable");
assert_false(e.cancelable, "input event should not be cancelable");
})
document.getElementById('file').onchange = t2.step_func_done(function(e) {
assert_true(e.bubbles, "change event bubbles");
assert_true(e.isTrusted, "change event should be trusted");
assert_false(e.cancelable, "change event shoud not be cancelable");
assert_false(e.cancelable, "change event should not be cancelable");
assert_true(input.files instanceof FileList);
assert_equals(input.value, "C:\\fakepath\\" + input.files[0].name);
})

View File

@ -15,8 +15,8 @@
<input type=radio id=radio5>
<input type=radio id=radio6 disabled>
<input type=radio id=radio71 checked>
<input type=radio id=radio72>
<input type=radio name="group5" id=radio71 checked>
<input type=radio name="group5" id=radio72>
<input type=radio name=group3 id=radio8 checked>
<input type=radio name=group3 id=radio9>
@ -37,8 +37,7 @@
radio9 = document.getElementById('radio9'),
radio10 = document.getElementById('radio10'),
radio11 = document.getElementById('radio11'),
t1 = async_test("click on mutable radio fires the input event"),
t2 = async_test("click on mutable radio fires the change event"),
t1 = async_test("click on mutable radio fires click event, then input event, then change event"),
t3 = async_test("click on non-mutable radio doesn't fire the input event"),
t4 = async_test("click on non-mutable radio doesn't fire the change event"),
t5 = async_test("canceled activation steps on unchecked radio"),
@ -80,18 +79,28 @@
assert_false(radio11.checked);
}, "changing the name of a radio input element and setting its checkedness to true makes all the other elements' checkedness in the same radio button group be set to false");
radio5.oninput= t1.step_func(function(e) {
input_fired = true;
assert_true(e.bubbles, "event should bubble")
assert_true(e.isTrusted, "event should be trusted");
assert_false(e.cancelable, "event shoud not be cancelable");
radio5.onclick = t1.step_func(function(e) {
click_fired = true;
assert_false(input_fired, "click event should fire before input event");
assert_false(change_fired, "click event should fire before change event");
});
radio5.onchange = t2.step_func(function(e) {
radio5.oninput = t1.step_func(function(e) {
input_fired = true;
assert_true(click_fired, "input event should fire after click event");
assert_false(change_fired, "input event should fire before change event");
assert_true(e.bubbles, "input event should bubble")
assert_true(e.isTrusted, "input event should be trusted");
assert_false(e.cancelable, "input event should not be cancelable");
});
radio5.onchange = t1.step_func(function(e) {
change_fired = true;
assert_true(e.bubbles, "event should bubble")
assert_true(e.isTrusted, "event should be trusted");
assert_false(e.cancelable, "event shoud not be cancelable");
assert_true(click_fired, "change event should fire after click event");
assert_true(input_fired, "change event should fire after input event");
assert_true(e.bubbles, "change event should bubble")
assert_true(e.isTrusted, "change event should be trusted");
assert_false(e.cancelable, "change event should not be cancelable");
});
radio6.oninput= t3.step_func_done(function(e) {
@ -108,11 +117,6 @@
t1.done();
});
t2.step(function() {
assert_true(change_fired);
t2.done();
})
t3.step(function(){
radio6.click();
t3.done();
@ -120,18 +124,20 @@
});
radio72.onclick = t5.step_func_done(function(e){
assert_false(radio71.checked);
assert_true(radio72.checked);
assert_false(radio71.checked, "click on radio should uncheck other radio in same group");
assert_true(radio72.checked, "click on radio should check that radio");
e.preventDefault();
assert_false(radio71.checked);
assert_true(radio72.checked);
// The cancelation of the click doesn't have an effect until after all the click event handlers have been run.
assert_false(radio71.checked, "radio remains unchecked immediately after click event on other radio in same group is canceled");
assert_true(radio72.checked, "clicked radio remains checked immediately after click event is canceled");
});
t5.step(function(){
assert_true(radio71.checked);
assert_false(radio72.checked);
assert_true(radio71.checked, "initially checked radio should be checked");
assert_false(radio72.checked, "other radios in same group as initially-checked radio should be unchecked");
radio72.click();
assert_true(radio71.checked);
assert_false(radio72.checked);
// Now that the click event has been fully dispatched, its cancelation has taken effect.
assert_true(radio71.checked, "canceled click event on radio should leave the previously-checked radio checked");
assert_false(radio72.checked, "canceled click event on previously-unchecked radio should leave that radio unchecked");
});
</script>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<title>HTMLBodyElement.onresize</title>
<link rel="author" title="His-Name-Is-Joof" href="mailto:jeffrharrison@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onresize">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test("body.onresize should set the window.onload handler")
window.onresize = t.step_func(function() {
assert_unreached("This handler should be overwritten.")
})
var body = document.createElement("body")
body.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, window,
"The event should be fired at the window.")
t.done()
})
window.dispatchEvent(new Event('resize'));
t = async_test("document.onresize should set the document.onresize handler");
document.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, document,
"The event should be fired at the document")
t.done()
})
document.dispatchEvent(new Event('resize'));
t = async_test("meta.onresize should set the meta.onresize handler");
var meta = document.createElement("meta")
meta.onresize = t.step_func(function(e) {
assert_equals(e.currentTarget, meta,
"The event should be fired at the <meta> object")
t.done()
})
meta.dispatchEvent(new Event('resize'));
</script>

View File

@ -0,0 +1,2 @@
@zqzhang
@tagawa

View File

@ -0,0 +1,4 @@
@bit
@acolwell
@shishimaru
@sideshowbarker

View File

@ -0,0 +1,2 @@
@hillbrad
@foolip

View File

@ -0,0 +1,3 @@
@dontcallmedom
@alvestrand

View File

@ -0,0 +1 @@
@kristijanburnik

View File

@ -0,0 +1,2 @@
@plehegar
@foolip

View File

@ -0,0 +1,4 @@
@chunywang
@sideshowbarker
@xinliux
@ibelem

View File

@ -0,0 +1,2 @@
@plehegar
@foolip

View File

@ -0,0 +1 @@
@plehegar

View File

@ -0,0 +1,7 @@
@bethge
@Steditor
@EvgenyAgafonchikov
@jacobrossi
@plehegar
@scottgonzalez
@staktrace

View File

@ -0,0 +1 @@
@plehegar

View File

@ -0,0 +1,2 @@
@zqzhang
@dontcallmedom

View File

@ -0,0 +1 @@
@zcorpan

View File

@ -0,0 +1 @@
@kristijanburnik

View File

@ -0,0 +1,3 @@
@haoxli
@plehegar
@zqzhang

View File

@ -0,0 +1 @@
@haoxli

View File

@ -0,0 +1 @@
@ayg

View File

@ -0,0 +1 @@
@ehsan

View File

@ -0,0 +1,2 @@
@inexorabletash
@wanderview

View File

@ -35,3 +35,203 @@ function cache_test(test_function, description) {
.then(test_function);
}, description);
}
// A set of Request/Response pairs to be used with prepopulated_cache_test().
var simple_entries = [
{
name: 'a',
request: new Request('http://example.com/a'),
response: new Response('')
},
{
name: 'b',
request: new Request('http://example.com/b'),
response: new Response('')
},
{
name: 'a_with_query',
request: new Request('http://example.com/a?q=r'),
response: new Response('')
},
{
name: 'A',
request: new Request('http://example.com/A'),
response: new Response('')
},
{
name: 'a_https',
request: new Request('https://example.com/a'),
response: new Response('')
},
{
name: 'a_org',
request: new Request('http://example.org/a'),
response: new Response('')
},
{
name: 'cat',
request: new Request('http://example.com/cat'),
response: new Response('')
},
{
name: 'catmandu',
request: new Request('http://example.com/catmandu'),
response: new Response('')
},
{
name: 'cat_num_lives',
request: new Request('http://example.com/cat?lives=9'),
response: new Response('')
},
{
name: 'cat_in_the_hat',
request: new Request('http://example.com/cat/in/the/hat'),
response: new Response('')
},
{
name: 'non_2xx_response',
request: new Request('http://example.com/non2xx'),
response: new Response('', {status: 404, statusText: 'nope'})
},
{
name: 'error_response',
request: new Request('http://example.com/error'),
response: Response.error()
},
];
// A set of Request/Response pairs to be used with prepopulated_cache_test().
// These contain a mix of test cases that use Vary headers.
var vary_entries = [
{
name: 'vary_cookie_is_cookie',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_is_good',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-good-enough-for-me'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_absent',
request: new Request('http://example.com/c'),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
}
];
// Run |test_function| with a Cache object and a map of entries. Prior to the
// call, the Cache is populated by cache entries from |entries|. The latter is
// expected to be an Object mapping arbitrary keys to objects of the form
// {request: <Request object>, response: <Response object>}. There's no
// guarantee on the order in which entries will be added to the cache.
//
// |test_function| should return a Promise that can be used with promise_test.
function prepopulated_cache_test(entries, test_function, description) {
cache_test(function(cache) {
var p = Promise.resolve();
var hash = {};
return Promise.all(entries.map(function(entry) {
hash[entry.name] = entry;
return cache.put(entry.request.clone(),
entry.response.clone())
.catch(function(e) {
assert_unreached(
'Test setup failed for entry ' + entry.name + ': ' + e);
});
}))
.then(function() {
assert_equals(Object.keys(hash).length, entries.length);
})
.then(function() {
return test_function(cache, hash);
});
}, description);
}
// Helper for testing with Headers objects. Compares Headers instances
// by serializing |expected| and |actual| to arrays and comparing.
function assert_header_equals(actual, expected, description) {
assert_class_string(actual, "Headers", description);
var header;
var actual_headers = [];
var expected_headers = [];
for (header of actual)
actual_headers.push(header[0] + ": " + header[1]);
for (header of expected)
expected_headers.push(header[0] + ": " + header[1]);
assert_array_equals(actual_headers, expected_headers,
description + " Headers differ.");
}
// Helper for testing with Response objects. Compares simple
// attributes defined on the interfaces, as well as the headers. It
// does not compare the response bodies.
function assert_response_equals(actual, expected, description) {
assert_class_string(actual, "Response", description);
["type", "url", "status", "ok", "statusText"].forEach(function(attribute) {
assert_equals(actual[attribute], expected[attribute],
description + " Attributes differ: " + attribute + ".");
});
assert_header_equals(actual.headers, expected.headers, description);
}
// Assert that the two arrays |actual| and |expected| contain the same
// set of Responses as determined by assert_response_equals. The order
// is not significant.
//
// |expected| is assumed to not contain any duplicates.
function assert_response_array_equivalent(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
expected.forEach(function(expected_element) {
// assert_response_in_array treats the first argument as being
// 'actual', and the second as being 'expected array'. We are
// switching them around because we want to be resilient
// against the |actual| array containing duplicates.
assert_response_in_array(expected_element, actual, description);
});
}
// Asserts that two arrays |actual| and |expected| contain the same
// set of Responses as determined by assert_response_equals(). The
// corresponding elements must occupy corresponding indices in their
// respective arrays.
function assert_response_array_equals(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
actual.forEach(function(value, index) {
assert_response_equals(value, expected[index],
description + " : object[" + index + "]");
});
}
// Equivalent to assert_in_array, but uses assert_response_equals.
function assert_response_in_array(actual, expected_array, description) {
assert_true(expected_array.some(function(element) {
try {
assert_response_equals(actual, element);
return true;
} catch (e) {
return false;
}
}), description);
}

View File

@ -31,70 +31,3 @@ function assert_promise_rejects(promise, code, description) {
}
});
}
// Helper for testing with Headers objects. Compares Headers instances
// by serializing |expected| and |actual| to arrays and comparing.
function assert_header_equals(actual, expected, description) {
assert_class_string(actual, "Headers", description);
var header, actual_headers = [], expected_headers = [];
for (header of actual)
actual_headers.push(header[0] + ": " + header[1]);
for (header of expected)
expected_headers.push(header[0] + ": " + header[1]);
assert_array_equals(actual_headers, expected_headers,
description + " Headers differ.");
}
// Helper for testing with Response objects. Compares simple
// attributes defined on the interfaces, as well as the headers. It
// does not compare the response bodies.
function assert_response_equals(actual, expected, description) {
assert_class_string(actual, "Response", description);
["type", "url", "status", "ok", "statusText"].forEach(function(attribute) {
assert_equals(actual[attribute], expected[attribute],
description + " Attributes differ: " + attribute + ".");
});
assert_header_equals(actual.headers, expected.headers, description);
}
// Assert that the two arrays |actual| and |expected| contain the same
// set of Responses as determined by assert_response_equals. The order
// is not significant.
//
// |expected| is assumed to not contain any duplicates.
function assert_response_array_equivalent(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
expected.forEach(function(expected_element) {
// assert_response_in_array treats the first argument as being
// 'actual', and the second as being 'expected array'. We are
// switching them around because we want to be resilient
// against the |actual| array containing duplicates.
assert_response_in_array(expected_element, actual, description);
});
}
// Asserts that two arrays |actual| and |expected| contain the same
// set of Responses as determined by assert_response_equals(). The
// corresponding elements must occupy corresponding indices in their
// respective arrays.
function assert_response_array_equals(actual, expected, description) {
assert_true(Array.isArray(actual), description);
assert_equals(actual.length, expected.length, description);
actual.forEach(function(value, index) {
assert_response_equals(value, expected[index],
description + " : object[" + index + "]");
});
}
// Equivalent to assert_in_array, but uses assert_response_equals.
function assert_response_in_array(actual, expected_array, description) {
assert_true(expected_array.some(function(element) {
try {
assert_response_equals(actual, element);
return true;
} catch (e) {
return false;
}
}), description);
}

View File

@ -16,6 +16,16 @@ cache_test(function(cache) {
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
return cache.match('../resources/simple.txt');
})
.then(function(response) {
assert_class_string(response, 'Response',
'Cache.add should put a resource in the cache.');
return response.text();
})
.then(function(body) {
assert_equals(body, 'a simple text file\n',
'Cache.add should retrieve the correct body.');
});
}, 'Cache.add called with relative URL specified as a string');
@ -35,6 +45,15 @@ cache_test(function(cache) {
});
}, 'Cache.add called with Request object');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt',
{method: 'POST', body: 'This is a body.'});
return assert_promise_rejects(
cache.add(request),
new TypeError(),
'Cache.add should throw a TypeError for non-GET requests.');
}, 'Cache.add called with POST request');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
return cache.add(request)
@ -51,6 +70,17 @@ cache_test(function(cache) {
});
}, 'Cache.add called twice with the same Request object');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
return request.text()
.then(function() {
assert_false(request.bodyUsed);
})
.then(function() {
return cache.add(request);
});
}, 'Cache.add with request with null body (not consumed)');
cache_test(function(cache) {
return cache.add('this-does-not-exist-please-dont-create-it')
.then(function(result) {
@ -84,19 +114,62 @@ cache_test(function(cache) {
}, 'Cache.addAll with a mix of valid and undefined arguments');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
return cache.addAll([])
.then(function(result) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
return cache.keys();
})
.then(function(result) {
assert_equals(result.length, 0,
'There should be no entry in the cache.');
});
}, 'Cache.addAll with an empty array');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and
// ../resources/blank.html
var urls = ['../resources/simple.txt',
self.location.href,
'../resources/blank.html'];
return cache.addAll(urls)
.then(function(result) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
return Promise.all(
urls.map(function(url) { return cache.match(url); }));
})
.then(function(responses) {
assert_class_string(
responses[0], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_class_string(
responses[1], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_class_string(
responses[2], 'Response',
'Cache.addAll should put a resource in the cache.');
return Promise.all(
responses.map(function(response) { return response.text(); }));
})
.then(function(bodies) {
assert_equals(
bodies[0], 'a simple text file\n',
'Cache.add should retrieve the correct body.');
assert_equals(
bodies[2], '<!DOCTYPE html>\n<title>Empty doc</title>\n',
'Cache.add should retrieve the correct body.');
});
}, 'Cache.addAll with string URL arguments');
cache_test(function(cache) {
// Assumes the existence of ../resources/simple.txt and ../resources/blank.html
var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
// Assumes the existence of ../resources/simple.txt and
// ../resources/blank.html
var urls = ['../resources/simple.txt',
self.location.href,
'../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
@ -105,13 +178,38 @@ cache_test(function(cache) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
return Promise.all(
urls.map(function(url) { return cache.match(url); }));
})
.then(function(responses) {
assert_class_string(
responses[0], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_class_string(
responses[1], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_class_string(
responses[2], 'Response',
'Cache.addAll should put a resource in the cache.');
return Promise.all(
responses.map(function(response) { return response.text(); }));
})
.then(function(bodies) {
assert_equals(
bodies[0], 'a simple text file\n',
'Cache.add should retrieve the correct body.');
assert_equals(
bodies[2], '<!DOCTYPE html>\n<title>Empty doc</title>\n',
'Cache.add should retrieve the correct body.');
});
}, 'Cache.addAll with Request arguments');
cache_test(function(cache) {
// Assumes that ../resources/simple.txt and ../resources/blank.html exist. The second
// resource does not.
var urls = ['../resources/simple.txt', 'this-resource-should-not-exist', '../resources/blank.html'];
// Assumes that ../resources/simple.txt and ../resources/blank.html exist.
// The second resource does not.
var urls = ['../resources/simple.txt',
'this-resource-should-not-exist',
'../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
@ -120,6 +218,32 @@ cache_test(function(cache) {
assert_equals(result, undefined,
'Cache.addAll should resolve with undefined on ' +
'success.');
return Promise.all(
urls.map(function(url) { return cache.match(url); }));
})
.then(function(responses) {
assert_class_string(
responses[0], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_class_string(
responses[1], 'Response',
'Cache.addAll should put a resource in the cache.');
assert_equals(
responses[1].status, 404,
'Cache.addAll should put a 404 resource in the cache.');
assert_class_string(
responses[2], 'Response',
'Cache.addAll should put a resource in the cache.');
return Promise.all(
responses.map(function(response) { return response.text(); }));
})
.then(function(bodies) {
assert_equals(
bodies[0], 'a simple text file\n',
'Cache.add should retrieve the correct body.');
assert_equals(
bodies[2], '<!DOCTYPE html>\n<title>Empty doc</title>\n',
'Cache.add should retrieve the correct body.');
});
}, 'Cache.addAll with a mix of succeeding and failing requests');

View File

@ -4,105 +4,6 @@ if (self.importScripts) {
importScripts('../resources/test-helpers.js');
}
// A set of Request/Response pairs to be used with prepopulated_cache_test().
var simple_entries = [
{
name: 'a',
request: new Request('http://example.com/a'),
response: new Response('')
},
{
name: 'b',
request: new Request('http://example.com/b'),
response: new Response('')
},
{
name: 'a_with_query',
request: new Request('http://example.com/a?q=r'),
response: new Response('')
},
{
name: 'A',
request: new Request('http://example.com/A'),
response: new Response('')
},
{
name: 'a_https',
request: new Request('https://example.com/a'),
response: new Response('')
},
{
name: 'a_org',
request: new Request('http://example.org/a'),
response: new Response('')
},
{
name: 'cat',
request: new Request('http://example.com/cat'),
response: new Response('')
},
{
name: 'catmandu',
request: new Request('http://example.com/catmandu'),
response: new Response('')
},
{
name: 'cat_num_lives',
request: new Request('http://example.com/cat?lives=9'),
response: new Response('')
},
{
name: 'cat_in_the_hat',
request: new Request('http://example.com/cat/in/the/hat'),
response: new Response('')
}
];
// A set of Request/Response pairs to be used with prepopulated_cache_test().
// These contain a mix of test cases that use Vary headers.
var vary_entries = [
{
name: 'vary_cookie_is_cookie',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_is_good',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'is-good-enough-for-me'}}),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_cookie_absent',
request: new Request('http://example.com/c'),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
}
];
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('not-present-in-the-cache')
.then(function(result) {
assert_response_array_equivalent(
result, [],
'Cache.matchAll should resolve with an empty array on failure.');
});
}, 'Cache.matchAll with no matching entries');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match('not-present-in-the-cache')
.then(function(result) {
@ -111,14 +12,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with no matching entries');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request.url)
.then(function(result) {
assert_response_array_equals(result, [entries.a.response],
'Cache.matchAll should match by URL.');
});
}, 'Cache.matchAll with URL');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request.url)
.then(function(result) {
@ -127,15 +20,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with URL');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request)
.then(function(result) {
assert_response_array_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request)
.then(function(result) {
@ -144,15 +28,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(new Request(entries.a.request.url))
.then(function(result) {
assert_response_array_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with new Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(new Request(entries.a.request.url))
.then(function(result) {
@ -161,23 +36,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with new Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of cached request.');
});
},
'Cache.matchAll with ignoreSearch option (request with no search ' +
'parameters)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a.request,
{ignoreSearch: true})
@ -195,22 +53,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
'Cache.match with ignoreSearch option (request with no search ' +
'parameters)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a_with_query.request,
{ignoreSearch: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of request.');
});
},
'Cache.matchAll with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.a_with_query.request,
{ignoreSearch: true})
@ -227,18 +69,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
},
'Cache.match with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.cat.request.url + '#mouse')
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.cat.response,
],
'Cache.matchAll should ignore URL fragment.');
});
}, 'Cache.matchAll with URL containing fragment');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match(entries.cat.request.url + '#mouse')
.then(function(result) {
@ -247,16 +77,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with URL containing fragment');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('http')
.then(function(result) {
assert_response_array_equivalent(
result, [],
'Cache.matchAll should treat query as a URL and not ' +
'just a string fragment.');
});
}, 'Cache.matchAll with string fragment "http" as query');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.match('http')
.then(function(result) {
@ -267,48 +87,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with string fragment "http" as query');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c')
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.vary_cookie_absent.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the query request, but is present in the cached ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'none-of-the-above'}}));
})
.then(function(result) {
assert_response_array_equivalent(
result,
[
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the cached request, but is present in the query ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}));
})
.then(function(result) {
assert_response_array_equivalent(
result,
[entries.vary_cookie_is_cookie.response],
'Cache.matchAll should match the entire header if a vary header ' +
'is present in both the query and cached requests.');
});
}, 'Cache.matchAll with responses containing "Vary" header');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.match('http://example.com/c')
.then(function(result) {
@ -321,21 +99,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
});
}, 'Cache.match with responses containing "Vary" header');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c',
{ignoreVary: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.vary_cookie_is_cookie.response,
entries.vary_cookie_is_good.response,
entries.vary_cookie_absent.response,
],
'Cache.matchAll should honor "ignoreVary" parameter.');
});
}, 'Cache.matchAll with "ignoreVary" parameter');
cache_test(function(cache) {
var request = new Request('http://example.com');
var response;
@ -397,7 +160,7 @@ cache_test(function(cache) {
}, 'Cache.match invoked multiple times for the same Request/Response');
prepopulated_cache_test(simple_entries, function(cache, entries) {
var request = new Request(entries.a.request, { method: 'POST' });
var request = new Request(entries.a.request.clone(), {method: 'POST'});
return cache.match(request)
.then(function(result) {
assert_equals(result, undefined,
@ -405,38 +168,26 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with POST Request');
// Helpers ---
prepopulated_cache_test(simple_entries, function(cache, entries) {
var response = entries.non_2xx_response.response;
return cache.match(entries.non_2xx_response.request.url)
.then(function(result) {
assert_response_equals(
result, entries.non_2xx_response.response,
'Cache.match should return a Response object that has the ' +
'same properties as a stored non-2xx response.');
});
}, 'Cache.match with a non-2xx Response');
// Run |test_function| with a Cache object as its only parameter. Prior to the
// call, the Cache is populated by cache entries from |entries|. The latter is
// expected to be an Object mapping arbitrary keys to objects of the form
// {request: <Request object>, response: <Response object>}. There's no
// guarantee on the order in which entries will be added to the cache.
//
// |test_function| should return a Promise that can be used with promise_test.
function prepopulated_cache_test(entries, test_function, description) {
cache_test(function(cache) {
var p = Promise.resolve();
var hash = {};
entries.forEach(function(entry) {
p = p.then(function() {
return cache.put(entry.request.clone(),
entry.response.clone())
.catch(function(e) {
assert_unreached('Test setup failed for entry ' +
entry.name + ': ' + e);
});
});
hash[entry.name] = entry;
prepopulated_cache_test(simple_entries, function(cache, entries) {
var response = entries.error_response.response;
return cache.match(entries.error_response.request.url)
.then(function(result) {
assert_response_equals(
result, entries.error_response.response,
'Cache.match should return a Response object that has the ' +
'same properties as a stored network error response.');
});
p = p.then(function() {
assert_equals(Object.keys(hash).length, entries.length);
});
return p.then(function() {
return test_function(cache, hash);
});
}, description);
}
}, 'Cache.match with a network error Response');
done();

View File

@ -0,0 +1,154 @@
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('../resources/testharness-helpers.js');
importScripts('../resources/test-helpers.js');
}
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('not-present-in-the-cache')
.then(function(result) {
assert_response_array_equivalent(
result, [],
'Cache.matchAll should resolve with an empty array on failure.');
});
}, 'Cache.matchAll with no matching entries');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request.url)
.then(function(result) {
assert_response_array_equals(result, [entries.a.response],
'Cache.matchAll should match by URL.');
});
}, 'Cache.matchAll with URL');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request)
.then(function(result) {
assert_response_array_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(new Request(entries.a.request.url))
.then(function(result) {
assert_response_array_equals(
result, [entries.a.response],
'Cache.matchAll should match by Request.');
});
}, 'Cache.matchAll with new Request');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of cached request.');
});
},
'Cache.matchAll with ignoreSearch option (request with no search ' +
'parameters)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a_with_query.request,
{ignoreSearch: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.a.response,
entries.a_with_query.response
],
'Cache.matchAll with ignoreSearch should ignore the ' +
'search parameters of request.');
});
},
'Cache.matchAll with ignoreSearch option (request with search parameter)');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.cat.request.url + '#mouse')
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.cat.response,
],
'Cache.matchAll should ignore URL fragment.');
});
}, 'Cache.matchAll with URL containing fragment');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll('http')
.then(function(result) {
assert_response_array_equivalent(
result, [],
'Cache.matchAll should treat query as a URL and not ' +
'just a string fragment.');
});
}, 'Cache.matchAll with string fragment "http" as query');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c')
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.vary_cookie_absent.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the query request, but is present in the cached ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'none-of-the-above'}}));
})
.then(function(result) {
assert_response_array_equivalent(
result,
[
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the cached request, but is present in the query ' +
'request.');
})
.then(function() {
return cache.matchAll(
new Request('http://example.com/c',
{headers: {'Cookies': 'is-for-cookie'}}));
})
.then(function(result) {
assert_response_array_equivalent(
result,
[entries.vary_cookie_is_cookie.response],
'Cache.matchAll should match the entire header if a vary header ' +
'is present in both the query and cached requests.');
});
}, 'Cache.matchAll with responses containing "Vary" header');
prepopulated_cache_test(vary_entries, function(cache, entries) {
return cache.matchAll('http://example.com/c',
{ignoreVary: true})
.then(function(result) {
assert_response_array_equivalent(
result,
[
entries.vary_cookie_is_cookie.response,
entries.vary_cookie_is_good.response,
entries.vary_cookie_absent.response
],
'Cache.matchAll should honor "ignoreVary" parameter.');
});
}, 'Cache.matchAll with "ignoreVary" parameter');
done();

View File

@ -250,16 +250,22 @@ cache_test(function(cache) {
assert_true(
response.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' +
'The text() method should set "body used" flag.');
return assert_promise_rejects(
cache.put(new Request(test_url), response),
new TypeError,
'[https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-put] ' +
'Cache put should reject with TypeError when Response ' +
'body is already used.');
});
'The text() method should make the body disturbed.');
var request = new Request(test_url);
return cache.put(request, response).then(() => {
assert_unreached('cache.put should be rejected');
}, () => {});
});
}, 'Cache.put with a used response body');
cache_test(function(cache) {
var response = new Response(test_body);
return cache.put(new Request(test_url), response)
.then(function() {
assert_throws(new TypeError(), () => response.body.getReader());
});
}, 'getReader() after Cache.put');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request(test_url),

View File

@ -106,7 +106,6 @@ promise_test(function(t) {
promise_test(function(t) {
var cache_name = 'cache-storage/open';
var url = '../resources/simple.txt';
var cache;
return self.caches.delete(cache_name)
.then(function() {
@ -135,7 +134,7 @@ promise_test(function(t) {
assert_array_equals(actual_urls, expected_urls,
'CacheStorage.open should return a new Cache ' +
'object for the same backing store.');
})
});
}, 'CacheStorage.open with existing cache');
promise_test(function(t) {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Cache.match and Cache.matchAll</title>
<title>Cache.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<title>Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-matchall">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-workers/resources/test-helpers.js"></script>
<script>
service_worker_test('../script-tests/cache-matchAll.js');
</script>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Cache Storage: Cache.match and Cache.matchAll</title>
<title>Cache Storage: Cache.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-matchall">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-matchAll.js"></script>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Cache.match and Cache.matchAll</title>
<title>Cache.match</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-match">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>Cache.matchAll</title>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-matchall">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
fetch_tests_from_worker(new Worker('../script-tests/cache-matchAll.js'));
</script>

View File

@ -0,0 +1,5 @@
@kojiishi
@rniwa
@sideshowbarker
@sizuhiko
@yutak

View File

@ -0,0 +1,6 @@
@metromoxie
@fmarier
@jonathanKingston
@mikewest
@hillbrad
@mastahyeti

View File

@ -0,0 +1,2 @@
@heycam
@Ms2ger

View File

@ -0,0 +1,3 @@
@jtangelder
@zqzhang
@cynthia

View File

@ -0,0 +1,4 @@
@koustuvsinha
@zqzhang
@haoxli
@Ms2ger

View File

@ -0,0 +1,8 @@
@mikewest
@frewsxcv
@tomalec
@rubys
@sideshowbarker
@zcorpan
@xiaojunwu
@smola

View File

@ -0,0 +1 @@
@plehegar

View File

@ -0,0 +1,3 @@
@dontcallmedom
@zqzhang
@xinliux

View File

@ -0,0 +1 @@
@birtles

View File

@ -0,0 +1 @@
@chrislo

View File

@ -0,0 +1,4 @@
@andreastt
@lukeis
@AutomatedTester
@shs96c

View File

@ -228,11 +228,11 @@ function go() {
checkGetAttachedShaders([fs], [], [fs], "attaching a single shader should give the expected list");
checkGetAttachedShaders([fs, vs], [], [fs, vs],
"attaching some shaders should give the expected list");
checkGetAttachedShaders([fs], [fs], [], "attaching a shader and detaching it shoud leave an empty list");
checkGetAttachedShaders([fs], [fs], [], "attaching a shader and detaching it should leave an empty list");
checkGetAttachedShaders([fs, vs], [fs, vs], [],
"attaching some shaders and detaching them in same order shoud leave an empty list");
"attaching some shaders and detaching them in same order should leave an empty list");
checkGetAttachedShaders([fs, vs], [vs, fs], [],
"attaching some shaders and detaching them in random order shoud leave an empty list");
"attaching some shaders and detaching them in random order should leave an empty list");
checkGetAttachedShaders([fs, vs], [vs], [fs],
"attaching and detaching some shaders should leave the difference list");
checkGetAttachedShaders([fs, vs], [fs], [vs],

View File

@ -0,0 +1,6 @@
@zqzhang
@sideshowbarker
@plehegar
@aogilvie
@Ms2ger
@jdm

View File

@ -0,0 +1,4 @@
@dontcallmedom
@tidoust
@alvestrand
@phoglund

View File

@ -17,7 +17,7 @@
var isOpenCalled = false;
wsocket.addEventListener('open', testOpen.step_func(function (evt) {
assert_equals(wsocket.protocol, __PROTOCOL, "protocol should be set to echo");
assert_equals(wsocket.protocol, "echo", "protocol should be set to echo");
wsocket.close();
isOpenCalled = true;
testOpen.done();

View File

@ -0,0 +1,9 @@
@kristijanburnik
@zcorpan
@plehegar
@zqzhang
@sideshowbarker
@foolip
@Jxck
@jdm
@Ms2ger

View File

@ -4,26 +4,9 @@ var __SECURE__PORT = {{ports[wss][0]}};
var __NEW__PORT = __PORT; //All ports are non-default for now
var __NEW__SECURE__PORT = __SECURE__PORT; //All ports are non-default for now
var __PATH = "echo";
var __CONTROLPATH = "control";
var __PROTOCOL = "echo";
var __PROTOCOLS = ["echo", "chat"];
var __REPEATED__PROTOCOLS = ["echo", "echo"];
var __REPEATED__PROTOCOLS_CASE_INSENSITIVE = ["echo", "eCho"];
var __URL;
var __IS__WEBSOCKET;
var __PASS = "Pass";
var __FAIL = "Fail";
var wsocket;
var csocket;
var data;
// variables for testing Close Browser/Navigate Away scenarios
var isAssociated = false;
var guid;
var dataReceived;
var closeCode;
var urlToOpen;
function IsWebSocket() {
if (!window.WebSocket) {
assert_true(false, "Browser does not support WebSocket");
@ -32,92 +15,93 @@ function IsWebSocket() {
function CreateWebSocketNonAbsolute() {
IsWebSocket();
__URL = __SERVER__NAME;
wsocket = new WebSocket(__URL);
var url = __SERVER__NAME;
wsocket = new WebSocket(url);
}
function CreateWebSocketNonWsScheme() {
IsWebSocket();
__URL = "http://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL);
var url = "http://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url);
}
function CreateWebSocketNonAsciiProtocol(nonAsciiProtocol) {
IsWebSocket();
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL, nonAsciiProtocol);
var url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url, nonAsciiProtocol);
}
function CreateWebSocketWithAsciiSep(asciiWithSep) {
IsWebSocket();
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL, asciiWithSep);
var url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url, asciiWithSep);
}
function CreateWebSocketWithBlockedPort(blockedPort) {
IsWebSocket();
__URL = "wss://" + __SERVER__NAME + ":" + blockedPort + "/" + __PATH;
wsocket = new WebSocket(__URL);
var url = "wss://" + __SERVER__NAME + ":" + blockedPort + "/" + __PATH;
wsocket = new WebSocket(url);
}
function CreateWebSocketWithSpaceInUrl(urlWithSpace) {
IsWebSocket();
__URL = "ws://" + urlWithSpace + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL);
var url = "ws://" + urlWithSpace + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url);
}
function CreateWebSocketWithSpaceInProtocol(protocolWithSpace) {
IsWebSocket();
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL, protocolWithSpace);
var url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url, protocolWithSpace);
}
function CreateWebSocketWithRepeatedProtocols() {
IsWebSocket();
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL, __REPEATED__PROTOCOLS);
var url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url, ["echo", "echo"]);
}
function CreateWebSocketWithRepeatedProtocolsCaseInsensitive() {
IsWebSocket();
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(__URL, __REPEATED__PROTOCOLS_CASE_INSENSITIVE);
var url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
wsocket = new WebSocket(url, ["echo", "eCho"]);
}
function CreateWebSocket(isSecure, isProtocol, isProtocols) {
IsWebSocket();
var url;
if (isSecure) {
if (__SECURE__PORT === null) {
throw new Error("wss not yet supported");
}
__URL = "wss://" + __SERVER__NAME + ":" + __SECURE__PORT + "/" + __PATH;
url = "wss://" + __SERVER__NAME + ":" + __SECURE__PORT + "/" + __PATH;
}
else {
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
url = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
}
if (isProtocol) {
wsocket = new WebSocket(__URL, __PROTOCOL);
wsocket = new WebSocket(url, "echo");
}
else if (isProtocols) {
wsocket = new WebSocket(__URL, __PROTOCOLS);
wsocket = new WebSocket(url, ["echo", "chat"]);
}
else {
wsocket = new WebSocket(__URL);
wsocket = new WebSocket(url);
}
return wsocket;
}
function CreateControlWebSocket(isSecure) {
IsWebSocket();
var url;
if (isSecure) {
__URL = "wss://" + __SERVER__NAME + ":" + __SECURE__PORT + "/" + __CONTROLPATH;
url = "wss://" + __SERVER__NAME + ":" + __SECURE__PORT + "/control";
}
else {
__URL = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __CONTROLPATH;
url = "ws://" + __SERVER__NAME + ":" + __PORT + "/control";
}
csocket = new WebSocket(__URL);
return csocket;
return new WebSocket(url);
}

View File

@ -0,0 +1,9 @@
@siusin
@inexorabletash
@zqzhang
@chunywang
@kangxu
@plehegar
@ibelem
@jdm
@Ms2ger

View File

@ -0,0 +1,6 @@
@zqzhang
@chunywang
@zcorpan
@caitp
@Ms2ger
@jdm

Some files were not shown because too many files have changed in this diff Show More