Bug 1121960 - Update web-platform-tests to revision 78bc2a28397159604ce41997e408fbb171e11f8f, a=testonly

This commit is contained in:
James Graham 2015-01-14 21:08:54 +00:00
parent 48ae92e185
commit d858f37981
23 changed files with 943 additions and 194 deletions

View File

@ -481,9 +481,18 @@
{
"url": "/DOMEvents/tests/submissions/Microsoft/support/style01.css"
},
{
"url": "/FileAPI/BlobURL/support/file_test1.js"
},
{
"url": "/FileAPI/BlobURL/support/file_test2.txt"
},
{
"url": "/FileAPI/FileReader-interface/support/blue-100x100.png"
},
{
"url": "/FileAPI/FileReader/support/file_test1.txt"
},
{
"url": "/FileAPI/filelist-section/support/upload.txt"
},
@ -4213,6 +4222,9 @@
{
"url": "/workers/constructors/Worker/undefined"
},
{
"url": "/workers/interfaces.idl"
},
{
"url": "/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js"
},
@ -9397,6 +9409,15 @@
{
"url": "/FileAPI/Blob-slice.html"
},
{
"url": "/FileAPI/BlobURL/test1_manual.html"
},
{
"url": "/FileAPI/BlobURL/test2_manual.html"
},
{
"url": "/FileAPI/BlobURL/test3_manual.html"
},
{
"url": "/FileAPI/File-constructor.html"
},
@ -9424,6 +9445,12 @@
{
"url": "/FileAPI/FileReader/Determining-Encoding.html"
},
{
"url": "/FileAPI/FileReader/test_errors_manual.html"
},
{
"url": "/FileAPI/FileReaderSync.worker"
},
{
"url": "/FileAPI/filelist-section/filelist.html"
},
@ -10156,6 +10183,9 @@
{
"url": "/IndexedDB/value_recursive.htm"
},
{
"url": "/WebCryptoAPI/test_getRandomValues.html"
},
{
"url": "/WebIDL/ecmascript-binding/es-exceptions/DOMException-constants.html"
},
@ -11137,9 +11167,6 @@
{
"url": "/dom/nodes/Document-contentType/contentType/contenttype_mimeheader_02.html"
},
{
"url": "/dom/nodes/Document-contentType/contentType/contenttype_mimeheader_03.html"
},
{
"url": "/dom/nodes/Document-contentType/contentType/contenttype_png.html"
},
@ -13564,6 +13591,9 @@
{
"url": "/html/semantics/embedded-content/the-img-element/current-pixel-density/error.html"
},
{
"url": "/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html"
},
{
"url": "/html/semantics/embedded-content/the-img-element/img.complete.html"
},
@ -14392,6 +14422,9 @@
{
"url": "/js/builtins/Object.prototype.hasOwnProperty-order.html"
},
{
"url": "/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html"
},
{
"url": "/js/builtins/WeakMap.prototype-properties.html"
},
@ -17065,6 +17098,9 @@
{
"url": "/workers/constructors/Worker/unresolvable-url.html"
},
{
"url": "/workers/interfaces.worker"
},
{
"url": "/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.html"
},
@ -17252,7 +17288,7 @@
"url": "/workers/semantics/encodings/004.html"
},
{
"url": "/workers/semantics/interface-objects/002.html"
"url": "/workers/semantics/interface-objects/002.worker"
},
{
"url": "/workers/semantics/interface-objects/003.html"
@ -17898,6 +17934,6 @@
"deleted": [],
"items": {}
},
"rev": "6e35a4cd58f8fa507fc90b9d7b7ff28153759cac",
"rev": "78bc2a28397159604ce41997e408fbb171e11f8f",
"url_base": "/"
}

View File

@ -0,0 +1 @@
var test_result = 'test1_OK';

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test file</title>
<style>
body {
margin: 0;
}
.block {
height: 5000px;
}
</style>
<script>
window.test_result = 'test3_OK';
</script>
</head>
<body>
<a id="block1"></a>
<div class="block"></div>
<a id="block2"></a>
<div class="block"></div>
</body>
</html>

View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blob and File reference URL Test(1)</title>
<link rel=help href="http://www.w3.org/TR/FileAPI/#convenienceAPI">
<link rel=author title="Breezewish" href="mailto:me@breeswish.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<form name="upload">
<input type="file" id="fileChooser">
</form>
<div>
<p>Test steps:</p>
<ol>
<li>Download the <a href="support/file_test1.js">file</a>.</li>
<li>Select the file in the file inputbox to run the test.</li>
</ol>
</div>
<div id="log"></div>
<script>
var fileChooser = document.querySelector('#fileChooser');
setup({explicit_done: true});
setup({explicit_timeout: true});
//Run the test when user selects a file
on_event(fileChooser, 'change', function() {
var testCount = 10000;
test(function() {
var list = [], file = fileChooser.files[0];
for (var i = 0; i <= testCount; i++) {
list.push(window.URL.createObjectURL(file));
}
list.sort();
for (var i = 0; i < testCount; i++) {
assert_not_equals(list[i], list[i+1], 'generated Blob URL should be unique');
}
}, 'Check whether generated Blob/File URL is unique (Notice: only generate for ' + testCount + ' times)');
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
var expected_file_content = "var test_result = 'test1_OK';";
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = t.step_func(function() {
switch (xhr.readyState) {
case xhr.DONE:
assert_equals(xhr.status, 200, 'status code should be 200');
assert_equals(xhr.responseText, expected_file_content);
t.done();
return;
}
});
xhr.send();
}, 'Check whether Blob/File URL could be used in XHR requests and could get expected data');
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
var expected_run_result = "test1_OK";
//expected file content:
// var test_result = 'test1_OK';
var e = document.createElement('script');
e.setAttribute('type', 'text/javascript');
e.setAttribute('src', url);
e.onload = t.step_func_done(function() {
assert_equals(test_result, expected_run_result);
});
document.body.appendChild(e);
}, 'Check whether Blob/File URL could be used in tags src like <script>');
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
URL.revokeObjectURL(url);
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = t.step_func(function() {
switch (xhr.readyState) {
case xhr.DONE:
assert_equals(xhr.status, 500, 'status code should be 500 if Blob URI is revoked.');
t.done();
return;
}
});
xhr.send();
}, 'Check whether revokeObjectURL works well');
done();
});
</script>
</body>
</html>

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blob and File reference URL Test(2)</title>
<link rel=help href="http://www.w3.org/TR/FileAPI/#convenienceAPI">
<link rel=author title="Breezewish" href="mailto:me@breeswish.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<form name="upload">
<input type="file" id="fileChooser"><br><input type="button" id="start" value="start">
</form>
<div>
<p>Test steps:</p>
<ol>
<li>Download the <a href="support/file_test2.txt">file</a>.</li>
<li>Select the file in the file inputbox.</li>
<li>Delete the file.</li>
<li>Click the 'start' button.</li>
</ol>
</div>
<div id="log"></div>
<script>
var fileChooser = document.querySelector('#fileChooser');
setup({explicit_done: true});
setup({explicit_timeout: true});
on_event(document.querySelector('#start'), 'click', function() {
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = t.step_func(function() {
switch (xhr.readyState) {
case xhr.DONE:
assert_equals(xhr.status, 500, 'status code should be 500.');
t.done();
return;
}
});
xhr.send();
}, 'Check whether the browser response 500 in XHR if the selected file which File/Blob URL refered is not found');
done();
});
</script>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blob and File reference URL Test(3)</title>
<link rel=help href="http://www.w3.org/TR/FileAPI/#convenienceAPI">
<link rel=author title="Breezewish" href="mailto:me@breeswish.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<form name="upload">
<input type="file" id="fileChooser">
</form>
<div>
<p>Test steps:</p>
<ol>
<li>Download the <a href="support/file_test3.html">file</a>.</li>
<li>Select the file in the file inputbox and the test will start.</li>
</ol>
</div>
<div id="log"></div>
<script>
var fileChooser = document.querySelector('#fileChooser');
setup({explicit_done: true});
setup({explicit_timeout: true});
on_event(fileChooser, 'change', function() {
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
var e = document.createElement('iframe');
e.setAttribute('src', url);
e.setAttribute('style', 'display:none;');
document.body.appendChild(e);
e.contentWindow.document.body.onload = t.step_func_done(function() {
assert_equals(e.contentWindow.test_result, 'test3_OK');
});
}, 'Check whether the iframe content could be accessed when using Blob/File URL in the same origin.');
async_test(function(t) {
var url = URL.createObjectURL(fileChooser.files[0]);
url += '#block2';
var e = document.createElement('iframe');
e.setAttribute('src', url);
document.body.appendChild(e);
e.contentWindow.document.body.onload = t.step_func_done(function() {
assert_equals(e.contentWindow.scrollY, 5000);
});
}, 'Check whether the Blob/File URL fragment is implemented.');
done();
});
</script>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FileReader Errors Test</title>
<link rel=help href="http://www.w3.org/TR/FileAPI/#convenienceAPI">
<link rel=author title="Breezewish" href="mailto:me@breeswish.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<form name="upload">
<input type="file" id="fileChooser"><br><input type="button" id="start" value="start">
</form>
<div>
<p>Test steps:</p>
<ol>
<li>Download the <a href="support/file_test1.txt">file</a>.</li>
<li>Select the file in the file inputbox.</li>
<li>Delete the file.</li>
<li>Click the 'start' button.</li>
</ol>
</div>
<div id="log"></div>
<script>
var fileChooser = document.querySelector('#fileChooser');
setup({explicit_done: true});
setup({explicit_timeout: true});
on_event(fileChooser, 'change', function() {
async_test(function(t) {
var reader = new FileReader();
reader.readAsArrayBuffer(fileChooser.files[0]);
reader.onloadend = t.step_func_done(function(event) {
assert_equals(event.target.readyState, FileReader.DONE);
assert_equals(reader.error, null);
});
}, 'FileReader.error should be null if there are no errors when reading');
});
on_event(document.querySelector('#start'), 'click', function() {
async_test(function(t) {
var reader = new FileReader();
reader.readAsArrayBuffer(fileChooser.files[0]);
reader.onloadend = t.step_func_done(function(event) {
assert_equals(event.target.readyState, FileReader.DONE);
assert_equals(reader.error.code, 8);
});
}, 'FileReader.error should be NOT_FOUND_ERR if the file is not found when reading');
done();
});
</script>
</body>
</html>

View File

@ -0,0 +1,28 @@
importScripts("/resources/testharness.js");
var blob, readerSync;
setup(function() {
readerSync = new FileReaderSync();
blob = new Blob(["test"]);
});
test(function() {
assert_true(readerSync instanceof FileReaderSync);
}, "Interface");
test(function() {
var text = readerSync.readAsText(blob);
assert_equals(text, "test");
}, "readAsText");
test(function() {
var data = readerSync.readAsDataURL(blob);
assert_equals(data.indexOf("data:"), 0);
}, "readAsDataURL");
test(function() {
var data = readerSync.readAsArrayBuffer(blob);
assert_true(data instanceof ArrayBuffer);
}, "readAsArrayBuffer");
done();

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>WebCryptoAPI: getRandomValues()</title>
<link rel="author" title="Sunil Yoo" href="mailto:usuanday83@gmail.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-Crypto-method-getRandomValues">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_equals(window.crypto.getRandomValues(new Int8Array(8)).constructor,
Int8Array, "crypto.getRandomValues(new Int8Array(8))")
assert_equals(window.crypto.getRandomValues(new Uint8Array(8)).constructor,
Uint8Array, "crypto.getRandomValues(new Uint8Array(8))")
assert_equals(window.crypto.getRandomValues(new Int16Array(8)).constructor,
Int16Array, "crypto.getRandomValues(new Int16Array(8))")
assert_equals(window.crypto.getRandomValues(new Uint16Array(8)).constructor,
Uint16Array, "crypto.getRandomValues(new Uint16Array(8))")
assert_equals(window.crypto.getRandomValues(new Int32Array(8)).constructor,
Int32Array, "crypto.getRandomValues(new Int32Array(8))")
assert_equals(window.crypto.getRandomValues(new Uint32Array(8)).constructor,
Uint32Array, "crypto.getRandomValues(new Uint32Array(8))")
assert_throws("QuotaExceededError", function() {
window.crypto.getRandomValues(new Int8Array(65537))
}, "crypto.getRandomValues length over 65536")
})
</script>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<title>Custom document.contentType === 'text/html' when no Content-Type header is provided in HTTP response</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<iframe style="display:none"></iframe>
<script>
async_test(function() {
var iframe = document.getElementsByTagName('iframe')[0];
iframe.addEventListener('load', this.step_func_done(function() {
assert_equals(iframe.contentDocument.contentType, "text/html");
}), false);
iframe.src = "../support/contenttype_setter.py?removeContentType=true";
});
</script>

View File

@ -0,0 +1,78 @@
<!doctype html>
<img
data-desc="img (no src)"
data-narrow=""
data-wide=""
data-no-change>
<img src=""
data-desc="img (empty src)"
data-narrow=""
data-wide=""
data-no-change>
<img src="/images/broken.png?30-{{GET[id]}}"
data-desc="img (src only) broken image"
data-narrow="/images/broken.png?30-{{GET[id]}}"
data-wide="/images/broken.png?30-{{GET[id]}}"
data-no-change>
<img src="/images/green-1x1.png?40-{{GET[id]}}"
data-desc="img (src only) valid image"
data-narrow="/images/green-1x1.png?40-{{GET[id]}}"
data-wide="/images/green-1x1.png?40-{{GET[id]}}"
data-no-change>
<img srcset="/images/broken.png?50-{{GET[id]}}"
data-desc="img (srcset 1 cand) broken image"
data-narrow="/images/broken.png?50-{{GET[id]}}"
data-wide="/images/broken.png?50-{{GET[id]}}"
data-no-change>
<img srcset="/images/green-1x1.png?60-{{GET[id]}}"
data-desc="img (srcset 1 cand) valid image"
data-narrow="/images/green-1x1.png?60-{{GET[id]}}"
data-wide="/images/green-1x1.png?60-{{GET[id]}}"
data-no-change>
<picture>
<source media="(max-width:500px)" srcset="/images/broken.png?70-{{GET[id]}}">
<img src="/images/broken.png?71-{{GET[id]}}"
data-desc="picture: source (max-width:500px) broken image, img broken image"
data-narrow="/images/broken.png?70-{{GET[id]}}"
data-wide="/images/broken.png?71-{{GET[id]}}">
</picture>
<picture>
<source media="(max-width:500px)" srcset="/images/broken.png?80-{{GET[id]}}">
<img src="/images/green-2x2.png?81-{{GET[id]}}"
data-desc="picture: source (max-width:500px) broken image, img valid image"
data-narrow="/images/broken.png?80-{{GET[id]}}"
data-wide="/images/green-2x2.png?81-{{GET[id]}}">
</picture>
<picture>
<source media="(max-width:500px)" srcset="/images/green-1x1.png?90-{{GET[id]}}">
<img src="/images/broken.png?91-{{GET[id]}}"
data-desc="picture: source (max-width:500px) valid image, img broken image"
data-narrow="/images/green-1x1.png?90-{{GET[id]}}"
data-wide="/images/broken.png?91-{{GET[id]}}">
</picture>
<picture>
<source media="(max-width:500px)" srcset="/images/green-1x1.png?100-{{GET[id]}}">
<img src="/images/green-2x2.png?101-{{GET[id]}}"
data-desc="picture: source (max-width:500px) valid image, img valid image"
data-narrow="/images/green-1x1.png?100-{{GET[id]}}"
data-wide="/images/green-2x2.png?101-{{GET[id]}}">
</picture>
<picture>
<source media="(max-width:500px)" srcset="/images/green-1x1.png?110-{{GET[id]}}">
<img src="/images/green-1x1.png?110-{{GET[id]}}"
data-desc="picture: same URL in source (max-width:500px) and img"
data-narrow="/images/green-1x1.png?110-{{GET[id]}}"
data-wide="/images/green-1x1.png?110-{{GET[id]}}"
data-no-change>
</picture>

View File

@ -0,0 +1,65 @@
<!doctype html>
<title>img viewport change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<style>
.narrow { width:50px }
.wide { width:1000px }
</style>
<div id=log></div>
<script>
setup({explicit_done:true});
function resolve(url) {
if (url === "") {
return url;
}
var a = document.createElement('a');
a.href = url;
return a.href;
}
function insertIframe(className) {
var iframe = document.createElement('iframe');
iframe.className = className;
iframe.src = 'iframed.sub.html?id=' + token();
document.body.appendChild(iframe);
}
insertIframe('narrow');
insertIframe('wide');
var start_date = new Date();
onload = function() {
var load_time = new Date() - start_date;
var iframes = document.getElementsByTagName('iframe');
[].forEach.call(iframes, function(iframe) {
[].forEach.call(iframe.contentDocument.images, function(img) {
var expected = {wide:resolve(img.dataset.wide), narrow:resolve(img.dataset.narrow)};
var current = iframe.className;
var next = current === 'wide' ? 'narrow' : 'wide';
var expect_change = expected[next].indexOf('broken.png') !== 0 && !('noChange' in img.dataset);
test(function() {
assert_equals(img.currentSrc, expected[current]);
}, img.dataset.desc + ', onload, ' + current);
async_test(function() {
img.onload = this.unreached_func('Got unexpected load event');
img.onerror = this.unreached_func('Got unexpected error event');
if (expect_change) {
img.onload = this.step_func_done(function() {
assert_equals(img.currentSrc, expected[next]);
});
} else {
setTimeout(this.step_func_done(), 500 + load_time);
}
}, img.dataset.desc + ', resize to ' + next);
});
iframe.classList.toggle('wide');
iframe.classList.toggle('narrow');
});
done();
}
</script>

View File

@ -0,0 +1,44 @@
<!doctype html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<meta charset="utf-8">
<title>Object.prototype.hasOwnProperty: Check prototype chain</title>
<link rel="author" title="Masaya Iseki" href="mailto:iseki.m.aa@gmail.com">
<link rel="help" href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.hasownproperty">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(function() {
[{}, []].forEach(function(that) {
that.prop = 'exists';
assert_true(that.hasOwnProperty('prop'));
assert_true('hasOwnProperty' in that);
assert_false(that.hasOwnProperty('hasOwnProperty'));
});
});
test(function() {
['foo', 42].forEach(function(that) {
assert_false(that.hasOwnProperty('hasOwnProperty'));
});
});
test(function() {
[null, undefined].forEach(function(that) {
assert_throws(new TypeError(),
function() { that.hasOwnProperty('hasOwnProperty'); });
});
});
</script>
</body>
</html>

View File

@ -3,8 +3,8 @@
<head>
<title>getUserMedia() triggers error callback when auth is denied</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-NavigatorUserMedia-getUserMedia-void-MediaStreamConstraints-constraints-NavigatorUserMediaSuccessCallback-successCallback-NavigatorUserMediaErrorCallback-errorCallback">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-NavigatorUserMediaError">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#error-names">
<link rel="help" href="http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStreamError">
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
</head>
<body>
@ -26,7 +26,7 @@ t.step(function() {
t.done();
}),
t.step_func(function (error) {
assert_equals(error.name, "PermissionDenied", "Permission denied error returned"); // see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22216
assert_equals(error.name, "PermissionDeniedError", "Permission denied error returned");
assert_equals(error.constraintName, null, "constraintName attribute not set for permission denied");
t.done();
}));

View File

@ -65,20 +65,26 @@ o<a href=# id=a_ancestor class=x><table id=table class=x><tbody id=tbody class=x
// id selector
{input:'#a:active, #b:active, #map1:active, #c:active, #img1:active, #map2:active, #d:active, #img2:active, #e:active, #f:active, #g:active, #h:active, #i:active, #j:active, #k:active, #l:active, #m:active, #n:active, #o:active, #a_ancestor:active, #table:active, #tbody:active, #tr:active, #td:active, #body:active, #html:active', prop:'caption-side', value:'bottom'},
{input:'#a:hover, #b:hover, #map1:hover, #c:hover, #img1:hover, #map2:hover, #d:hover, #img2:hover, #e:hover, #f:hover, #g:hover, #h:hover, #i:hover, #j:hover, #k:hover, #l:hover, #m:hover, #n:hover, #o:hover, #a_ancestor:hover, #table:hover, #tbody:hover, #tr:hover, #td:hover, #body:hover, #html:hover', prop:'clear', value:'left'},
{input:':active#a, :active#b, :active#map1, :active#c, :active#img1, :active#map2, :active#d, :active#img2, :active#e, :active#f, :active#g, :active#h, :active#i, :active#j, :active#k, :active#l, :active#m, :active#n, :active#o, :active#a_ancestor, :active#table, :active#tbody, :active#tr, :active#td, :active#body, :active#html', prop:'list-style-type', value:'circle'},
{input:':hover#a, :hover#b, :hover#map1, :hover#c, :hover#img1, :hover#map2, :hover#d, :hover#img2, :hover#e, :hover#f, :hover#g, :hover#h, :hover#i, :hover#j, :hover#k, :hover#l, :hover#m, :hover#n, :hover#o, :hover#a_ancestor, :hover#table, :hover#tbody, :hover#tr, :hover#td, :hover#body, :hover#html', prop:'max-height', value:'10000px'},
// class selector
{input:'.t:active, .x:active', prop:'cursor', value:'move'},
{input:'.t:hover, .x:hover', prop:'empty-cells', value:'hide'},
{input:':active.t, :active.x', prop:'max-width', value:'10000px'},
{input:':hover.t, :hover.x', prop:'min-height', value:'1px'},
// pseudo-class selector
{input:':lang(en):active', prop:'font-style', value:'italic'},
{input:':lang(en):hover', prop:'font-variant', value:'small-caps'},
{input:':active:lang(en)', prop:'min-width', value:'1px'},
{input:':hover:lang(en)', prop:'overflow', value:'hidden'},
// pseudo-element selector
{input:':active::before', prop:'top', value:'1px', pseudoElt:'::before'},
{input:':hover::before', prop:'right', value:'1px', pseudoElt:'::before'},
{input:':active::after', prop:'bottom', value:'1px', pseudoElt:'::after'},
{input:':hover::after', prop:'left', value:'1px', pseudoElt:'::after'},
// as argument
{input:':matches(:active)', prop:'font-weight', value:'bold'},
{input:':matches(:hover)', prop:'list-style-position', value:'inside'},
//{input:':matches(:active)', prop:'font-weight', value:'bold'},
//{input:':matches(:hover)', prop:'list-style-position', value:'inside'},
];
var stylesheet = '';

View File

@ -58,7 +58,7 @@ function constValue (cnt) {
/// IdlArray ///
// Entry point
window.IdlArray = function()
self.IdlArray = function()
//@{
{
/**
@ -450,13 +450,13 @@ IdlArray.prototype.assert_type_is = function(value, type)
// IdlInterface.prototype.test_instance_of, because that could result
// in an infinite loop. TODO: This means we don't have tests for
// NoInterfaceObject interfaces, and we also can't test objects that
// come from another window.
// come from another self.
assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
if (value instanceof Object
&& !this.members[type].has_extended_attribute("NoInterfaceObject")
&& type in window)
&& type in self)
{
assert_true(value instanceof window[type], "not instanceof " + type);
assert_true(value instanceof self[type], "not instanceof " + type);
}
}
else if (this.members[type] instanceof IdlEnum)
@ -614,14 +614,14 @@ IdlException.prototype.test_self = function()
// to any constants that have been associated with the exception. The
// property has the attributes { [[Writable]]: true, [[Enumerable]]:
// false, [[Configurable]]: true }."
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
var desc = Object.getOwnPropertyDescriptor(window, this.name);
assert_false("get" in desc, "window's property " + format_value(this.name) + " has getter");
assert_false("set" in desc, "window's property " + format_value(this.name) + " has setter");
assert_true(desc.writable, "window's property " + format_value(this.name) + " is not writable");
assert_false(desc.enumerable, "window's property " + format_value(this.name) + " is enumerable");
assert_true(desc.configurable, "window's property " + format_value(this.name) + " is not configurable");
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
var desc = Object.getOwnPropertyDescriptor(self, this.name);
assert_false("get" in desc, "self's property " + format_value(this.name) + " has getter");
assert_false("set" in desc, "self's property " + format_value(this.name) + " has setter");
assert_true(desc.writable, "self's property " + format_value(this.name) + " is not writable");
assert_false(desc.enumerable, "self's property " + format_value(this.name) + " is enumerable");
assert_true(desc.configurable, "self's property " + format_value(this.name) + " is not configurable");
// "The exception interface object for a given exception must be a
// function object."
@ -631,8 +631,8 @@ IdlException.prototype.test_self = function()
// object."
// Note: This doesn't match browsers as of December 2011, see
// http://www.w3.org/Bugs/Public/show_bug.cgi?id=14813
assert_equals(Object.getPrototypeOf(window[this.name]), Function.prototype,
"prototype of window's property " + format_value(this.name) + " is not Function.prototype");
assert_equals(Object.getPrototypeOf(self[this.name]), Function.prototype,
"prototype of self's property " + format_value(this.name) + " is not Function.prototype");
// "Its [[Get]] internal property is set as described in ECMA-262
// section 15.3.5.4."
// Not much to test for this.
@ -645,7 +645,7 @@ IdlException.prototype.test_self = function()
// "Its [[Class]] internal property is “Function”."
// String() returns something implementation-dependent, because it
// calls Function#toString.
assert_class_string(window[this.name], "Function",
assert_class_string(self[this.name], "Function",
"class string of " + this.name);
// TODO: Test 4.9.1.1. Exception interface object [[Call]] method
@ -655,17 +655,17 @@ IdlException.prototype.test_self = function()
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
// "The exception interface object must also have a property named
// “prototype” with attributes { [[Writable]]: false, [[Enumerable]]:
// false, [[Configurable]]: false } whose value is an object called the
// exception interface prototype object. This object also provides
// access to the constants that are declared on the exception."
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'exception "' + this.name + '" does not have own property "prototype"');
var desc = Object.getOwnPropertyDescriptor(window[this.name], "prototype");
var desc = Object.getOwnPropertyDescriptor(self[this.name], "prototype");
assert_false("get" in desc, this.name + ".prototype has getter");
assert_false("set" in desc, this.name + ".prototype has setter");
assert_false(desc.writable, this.name + ".prototype is writable");
@ -685,18 +685,18 @@ IdlException.prototype.test_self = function()
// Note: This doesn't match browsers as of December 2011, see
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=14887.
var inherit_exception = this.base ? this.base : "Error";
assert_own_property(window, inherit_exception,
'should inherit from ' + inherit_exception + ', but window has no such property');
assert_own_property(window[inherit_exception], "prototype",
assert_own_property(self, inherit_exception,
'should inherit from ' + inherit_exception + ', but self has no such property');
assert_own_property(self[inherit_exception], "prototype",
'should inherit from ' + inherit_exception + ', but that object has no "prototype" property');
assert_equals(Object.getPrototypeOf(window[this.name].prototype),
window[inherit_exception].prototype,
assert_equals(Object.getPrototypeOf(self[this.name].prototype),
self[inherit_exception].prototype,
'prototype of ' + this.name + '.prototype is not ' + inherit_exception + '.prototype');
// "The class string of an exception interface prototype object is the
// concatenation of the exceptions identifier and the string
// “Prototype”."
assert_class_string(window[this.name].prototype, this.name + "Prototype",
assert_class_string(self[this.name].prototype, this.name + "Prototype",
"class string of " + this.name + ".prototype");
// TODO: Test String(), based on ES definition of
// Error.prototype.toString?
@ -704,18 +704,18 @@ IdlException.prototype.test_self = function()
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// "There must be a property named “name” on the exception interface
// prototype object with attributes { [[Writable]]: true,
// [[Enumerable]]: false, [[Configurable]]: true } and whose value is
// the identifier of the exception."
assert_own_property(window[this.name].prototype, "name",
assert_own_property(self[this.name].prototype, "name",
'prototype object does not have own property "name"');
var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "name");
var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, "name");
assert_false("get" in desc, this.name + ".prototype.name has getter");
assert_false("set" in desc, this.name + ".prototype.name has setter");
assert_true(desc.writable, this.name + ".prototype.name is not writable");
@ -726,9 +726,9 @@ IdlException.prototype.test_self = function()
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// "If the [NoInterfaceObject] extended attribute was not specified on
@ -737,15 +737,15 @@ IdlException.prototype.test_self = function()
// attributes { [[Writable]]: true, [[Enumerable]]: false,
// [[Configurable]]: true } and whose value is a reference to the
// exception interface object for the exception."
assert_own_property(window[this.name].prototype, "constructor",
assert_own_property(self[this.name].prototype, "constructor",
this.name + '.prototype does not have own property "constructor"');
var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "constructor");
var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, "constructor");
assert_false("get" in desc, this.name + ".prototype.constructor has getter");
assert_false("set" in desc, this.name + ".prototype.constructor has setter");
assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
assert_equals(window[this.name].prototype.constructor, window[this.name],
assert_equals(self[this.name].prototype.constructor, self[this.name],
this.name + '.prototype.constructor is not the same object as ' + this.name);
}.bind(this), this.name + " exception: existence and properties of exception interface prototype object's \"constructor\" property");
};
@ -765,22 +765,22 @@ IdlException.prototype.test_members = function()
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
// "For each constant defined on the exception, there must be a
// corresponding property on the exception interface object, if
// it exists, if the identifier of the constant is not
// “prototype”."
assert_own_property(window[this.name], member.name);
assert_own_property(self[this.name], member.name);
// "The value of the property is the ECMAScript value that is
// equivalent to the constants IDL value, according to the
// rules in section 4.2 above."
assert_equals(window[this.name][member.name], constValue(member.value),
assert_equals(self[this.name][member.name], constValue(member.value),
"property has wrong value");
// "The property has attributes { [[Writable]]: false,
// [[Enumerable]]: true, [[Configurable]]: false }."
var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
assert_false("get" in desc, "property has getter");
assert_false("set" in desc, "property has setter");
assert_false(desc.writable, "property is writable");
@ -791,15 +791,15 @@ IdlException.prototype.test_members = function()
// exist on the exception interface prototype object."
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'exception "' + this.name + '" does not have own property "prototype"');
assert_own_property(window[this.name].prototype, member.name);
assert_equals(window[this.name].prototype[member.name], constValue(member.value),
assert_own_property(self[this.name].prototype, member.name);
assert_equals(self[this.name].prototype[member.name], constValue(member.value),
"property has wrong value");
var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, member.name);
var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, member.name);
assert_false("get" in desc, "property has getter");
assert_false("set" in desc, "property has setter");
assert_false(desc.writable, "property is writable");
@ -811,9 +811,9 @@ IdlException.prototype.test_members = function()
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'exception "' + this.name + '" does not have own property "prototype"');
// "For each exception field, there must be a corresponding
@ -821,11 +821,11 @@ IdlException.prototype.test_members = function()
// characteristics are as follows:
// "The name of the property is the identifier of the exception
// field."
assert_own_property(window[this.name].prototype, member.name);
assert_own_property(self[this.name].prototype, member.name);
// "The property has attributes { [[Get]]: G, [[Enumerable]]:
// true, [[Configurable]]: true }, where G is the exception
// field getter, defined below."
var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, member.name);
var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, member.name);
assert_false("value" in desc, "property descriptor has value but is supposed to be accessor");
assert_false("writable" in desc, 'property descriptor has "writable" field but is supposed to be accessor');
// TODO: ES5 doesn't seem to say whether desc should have a
@ -847,7 +847,7 @@ IdlException.prototype.test_members = function()
// TODO: Test on a platform object representing an exception.
assert_throws(new TypeError(), function()
{
window[this.name].prototype[member.name];
self[this.name].prototype[member.name];
}.bind(this), "getting property on prototype object must throw TypeError");
assert_throws(new TypeError(), function()
{
@ -885,9 +885,9 @@ IdlException.prototype.test_object = function(desc)
if (!this.has_extended_attribute("NoInterfaceObject")
&& (typeof obj != "object" || obj instanceof Object))
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'exception "' + this.name + '" does not have own property "prototype"');
// "The value of the internal [[Prototype]] property of the
@ -895,7 +895,7 @@ IdlException.prototype.test_object = function(desc)
// object from the global environment the exception object is
// associated with."
assert_equals(Object.getPrototypeOf(obj),
window[this.name].prototype,
self[this.name].prototype,
desc + "'s prototype is not " + this.name + ".prototype");
}
@ -968,20 +968,20 @@ IdlInterface.prototype.test_self = function()
// TODO: Should we test here that the property is actually writable
// etc., or trust getOwnPropertyDescriptor?
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
var desc = Object.getOwnPropertyDescriptor(window, this.name);
assert_false("get" in desc, "window's property " + format_value(this.name) + " has getter");
assert_false("set" in desc, "window's property " + format_value(this.name) + " has setter");
assert_true(desc.writable, "window's property " + format_value(this.name) + " is not writable");
assert_false(desc.enumerable, "window's property " + format_value(this.name) + " is enumerable");
assert_true(desc.configurable, "window's property " + format_value(this.name) + " is not configurable");
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
var desc = Object.getOwnPropertyDescriptor(self, this.name);
assert_false("get" in desc, "self's property " + format_value(this.name) + " has getter");
assert_false("set" in desc, "self's property " + format_value(this.name) + " has setter");
assert_true(desc.writable, "self's property " + format_value(this.name) + " is not writable");
assert_false(desc.enumerable, "self's property " + format_value(this.name) + " is enumerable");
assert_true(desc.configurable, "self's property " + format_value(this.name) + " is not configurable");
if (this.is_callback()) {
// "The internal [[Prototype]] property of an interface object for
// a callback interface MUST be the Object.prototype object."
assert_equals(Object.getPrototypeOf(window[this.name]), Object.prototype,
"prototype of window's property " + format_value(this.name) + " is not Object.prototype");
assert_equals(Object.getPrototypeOf(self[this.name]), Object.prototype,
"prototype of self's property " + format_value(this.name) + " is not Object.prototype");
return;
}
@ -993,8 +993,8 @@ IdlInterface.prototype.test_self = function()
// "* Its [[Prototype]] internal property is the Function prototype
// object."
assert_equals(Object.getPrototypeOf(window[this.name]), Function.prototype,
"prototype of window's property " + format_value(this.name) + " is not Function.prototype");
assert_equals(Object.getPrototypeOf(self[this.name]), Function.prototype,
"prototype of self's property " + format_value(this.name) + " is not Function.prototype");
// "* Its [[Get]] internal property is set as described in ECMA-262
// section 15.3.5.4."
@ -1012,7 +1012,7 @@ IdlInterface.prototype.test_self = function()
// "* Its [[NativeBrand]] internal property is “Function”."
// String() returns something implementation-dependent, because it calls
// Function#toString.
assert_class_string(window[this.name], "Function", "class string of " + this.name);
assert_class_string(self[this.name], "Function", "class string of " + this.name);
if (!this.has_extended_attribute("Constructor")) {
// "The internal [[Call]] method of the interface object behaves as
@ -1021,10 +1021,10 @@ IdlInterface.prototype.test_self = function()
// "If I was not declared with a [Constructor] extended attribute,
// then throw a TypeError."
assert_throws(new TypeError(), function() {
window[this.name]();
self[this.name]();
}.bind(this), "interface object didn't throw TypeError when called as a function");
assert_throws(new TypeError(), function() {
new window[this.name]();
new self[this.name]();
}.bind(this), "interface object didn't throw TypeError when called as a constructor");
}
}.bind(this), this.name + " interface: existence and properties of interface object");
@ -1034,15 +1034,15 @@ IdlInterface.prototype.test_self = function()
// This function tests WebIDL as of 2014-10-25.
// https://heycam.github.io/webidl/#es-interface-call
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
// "Interface objects for non-callback interfaces MUST have a
// property named “length” with attributes { [[Writable]]: false,
// [[Enumerable]]: false, [[Configurable]]: true } whose value is
// a Number."
assert_own_property(window[this.name], "length");
var desc = Object.getOwnPropertyDescriptor(window[this.name], "length");
assert_own_property(self[this.name], "length");
var desc = Object.getOwnPropertyDescriptor(self[this.name], "length");
assert_false("get" in desc, this.name + ".length has getter");
assert_false("set" in desc, this.name + ".length has setter");
assert_false(desc.writable, this.name + ".length is writable");
@ -1067,7 +1067,7 @@ IdlInterface.prototype.test_self = function()
})
.reduce(function(m, n) { return Math.min(m, n); });
}
assert_equals(window[this.name].length, expected_length, "wrong value for " + this.name + ".length");
assert_equals(self[this.name].length, expected_length, "wrong value for " + this.name + ".length");
}.bind(this), this.name + " interface object length");
}
@ -1075,11 +1075,11 @@ IdlInterface.prototype.test_self = function()
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
if (this.has_extended_attribute("Callback")) {
assert_false("prototype" in window[this.name],
assert_false("prototype" in self[this.name],
this.name + ' should not have a "prototype" property');
return;
}
@ -1090,9 +1090,9 @@ IdlInterface.prototype.test_self = function()
// interface prototype object. This object has properties that
// correspond to the attributes and operations defined on the
// interface, and is described in more detail in section 4.5.3 below."
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
var desc = Object.getOwnPropertyDescriptor(window[this.name], "prototype");
var desc = Object.getOwnPropertyDescriptor(self[this.name], "prototype");
assert_false("get" in desc, this.name + ".prototype has getter");
assert_false("set" in desc, this.name + ".prototype has setter");
assert_false(desc.writable, this.name + ".prototype is writable");
@ -1131,18 +1131,18 @@ IdlInterface.prototype.test_self = function()
inherit_interface_has_interface_object = true;
}
if (inherit_interface_has_interface_object) {
assert_own_property(window, inherit_interface,
'should inherit from ' + inherit_interface + ', but window has no such property');
assert_own_property(window[inherit_interface], 'prototype',
assert_own_property(self, inherit_interface,
'should inherit from ' + inherit_interface + ', but self has no such property');
assert_own_property(self[inherit_interface], 'prototype',
'should inherit from ' + inherit_interface + ', but that object has no "prototype" property');
assert_equals(Object.getPrototypeOf(window[this.name].prototype),
window[inherit_interface].prototype,
assert_equals(Object.getPrototypeOf(self[this.name].prototype),
self[inherit_interface].prototype,
'prototype of ' + this.name + '.prototype is not ' + inherit_interface + '.prototype');
} else {
// We can't test that we get the correct object, because this is the
// only way to get our hands on it. We only test that its class
// string, at least, is correct.
assert_class_string(Object.getPrototypeOf(window[this.name].prototype),
assert_class_string(Object.getPrototypeOf(self[this.name].prototype),
inherit_interface + 'Prototype',
'Class name for prototype of ' + this.name +
'.prototype is not "' + inherit_interface + 'Prototype"');
@ -1151,28 +1151,28 @@ IdlInterface.prototype.test_self = function()
// "The class string of an interface prototype object is the
// concatenation of the interfaces identifier and the string
// “Prototype”."
assert_class_string(window[this.name].prototype, this.name + "Prototype",
assert_class_string(self[this.name].prototype, this.name + "Prototype",
"class string of " + this.name + ".prototype");
// String() should end up calling {}.toString if nothing defines a
// stringifier.
if (!this.has_stringifier()) {
assert_equals(String(window[this.name].prototype), "[object " + this.name + "Prototype]",
assert_equals(String(self[this.name].prototype), "[object " + this.name + "Prototype]",
"String(" + this.name + ".prototype)");
}
}.bind(this), this.name + " interface: existence and properties of interface prototype object");
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
if (this.has_extended_attribute("Callback")) {
assert_false("prototype" in window[this.name],
assert_false("prototype" in self[this.name],
this.name + ' should not have a "prototype" property');
return;
}
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// "If the [NoInterfaceObject] extended attribute was not specified on
@ -1180,15 +1180,15 @@ IdlInterface.prototype.test_self = function()
// property named “constructor” with attributes { [[Writable]]: true,
// [[Enumerable]]: false, [[Configurable]]: true } whose value is a
// reference to the interface object for the interface."
assert_own_property(window[this.name].prototype, "constructor",
assert_own_property(self[this.name].prototype, "constructor",
this.name + '.prototype does not have own property "constructor"');
var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "constructor");
var desc = Object.getOwnPropertyDescriptor(self[this.name].prototype, "constructor");
assert_false("get" in desc, this.name + ".prototype.constructor has getter");
assert_false("set" in desc, this.name + ".prototype.constructor has setter");
assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
assert_equals(window[this.name].prototype.constructor, window[this.name],
assert_equals(self[this.name].prototype.constructor, self[this.name],
this.name + '.prototype.constructor is not the same object as ' + this.name);
}.bind(this), this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
};
@ -1199,21 +1199,21 @@ IdlInterface.prototype.test_member_const = function(member)
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
// "For each constant defined on an interface A, there must be
// a corresponding property on the interface object, if it
// exists."
assert_own_property(window[this.name], member.name);
assert_own_property(self[this.name], member.name);
// "The value of the property is that which is obtained by
// converting the constants IDL value to an ECMAScript
// value."
assert_equals(window[this.name][member.name], constValue(member.value),
assert_equals(self[this.name][member.name], constValue(member.value),
"property has wrong value");
// "The property has attributes { [[Writable]]: false,
// [[Enumerable]]: true, [[Configurable]]: false }."
var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
assert_false("get" in desc, "property has getter");
assert_false("set" in desc, "property has setter");
assert_false(desc.writable, "property is writable");
@ -1224,22 +1224,22 @@ IdlInterface.prototype.test_member_const = function(member)
// exist on the interface prototype object."
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
if (this.has_extended_attribute("Callback")) {
assert_false("prototype" in window[this.name],
assert_false("prototype" in self[this.name],
this.name + ' should not have a "prototype" property');
return;
}
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
assert_own_property(window[this.name].prototype, member.name);
assert_equals(window[this.name].prototype[member.name], constValue(member.value),
assert_own_property(self[this.name].prototype, member.name);
assert_equals(self[this.name].prototype[member.name], constValue(member.value),
"property has wrong value");
var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
var desc = Object.getOwnPropertyDescriptor(self[this.name], member.name);
assert_false("get" in desc, "property has getter");
assert_false("set" in desc, "property has setter");
assert_false(desc.writable, "property is writable");
@ -1255,31 +1255,31 @@ IdlInterface.prototype.test_member_attribute = function(member)
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
if (member["static"]) {
assert_own_property(window[this.name], member.name,
assert_own_property(self[this.name], member.name,
"The interface object must have a property " +
format_value(member.name));
}
else
{
assert_true(member.name in window[this.name].prototype,
assert_true(member.name in self[this.name].prototype,
"The prototype object must have a property " +
format_value(member.name));
if (!member.has_extended_attribute("LenientThis")) {
assert_throws(new TypeError(), function() {
window[this.name].prototype[member.name];
self[this.name].prototype[member.name];
}.bind(this), "getting property on prototype object must throw TypeError");
} else {
assert_equals(window[this.name].prototype[member.name], undefined,
assert_equals(self[this.name].prototype[member.name], undefined,
"getting property on prototype object must return undefined");
}
do_interface_attribute_asserts(window[this.name].prototype, member);
do_interface_attribute_asserts(self[this.name].prototype, member);
}
}.bind(this), this.name + " interface: attribute " + member.name);
};
@ -1290,16 +1290,16 @@ IdlInterface.prototype.test_member_operation = function(member)
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
if (this.has_extended_attribute("Callback")) {
assert_false("prototype" in window[this.name],
assert_false("prototype" in self[this.name],
this.name + ' should not have a "prototype" property');
return;
}
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// "For each unique identifier of an operation defined on the
@ -1312,15 +1312,15 @@ IdlInterface.prototype.test_member_operation = function(member)
//
var prototypeOrInterfaceObject;
if (member["static"]) {
assert_own_property(window[this.name], member.name,
assert_own_property(self[this.name], member.name,
"interface prototype object missing static operation");
prototypeOrInterfaceObject = window[this.name];
prototypeOrInterfaceObject = self[this.name];
}
else
{
assert_own_property(window[this.name].prototype, member.name,
assert_own_property(self[this.name].prototype, member.name,
"interface prototype object missing non-static operation");
prototypeOrInterfaceObject = window[this.name].prototype;
prototypeOrInterfaceObject = self[this.name].prototype;
}
var desc = Object.getOwnPropertyDescriptor(prototypeOrInterfaceObject, member.name);
@ -1362,7 +1362,7 @@ IdlInterface.prototype.test_member_operation = function(member)
// TODO: We currently ignore the [ImplicitThis] case.
if (!member["static"]) {
assert_throws(new TypeError(), function() {
window[this.name].prototype[member.name].apply(null, args);
self[this.name].prototype[member.name].apply(null, args);
}, "calling operation with this = null didn't throw TypeError");
}
@ -1372,7 +1372,7 @@ IdlInterface.prototype.test_member_operation = function(member)
// TODO: Test a platform object that implements some other
// interface. (Have to be sure to get inheritance right.)
assert_throws(new TypeError(), function() {
window[this.name].prototype[member.name].apply({}, args);
self[this.name].prototype[member.name].apply({}, args);
}, "calling operation with this = {} didn't throw TypeError");
}.bind(this), this.name + " interface: operation " + member.name +
"(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
@ -1385,21 +1385,21 @@ IdlInterface.prototype.test_member_stringifier = function(member)
{
test(function()
{
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
if (this.has_extended_attribute("Callback")) {
assert_false("prototype" in window[this.name],
assert_false("prototype" in self[this.name],
this.name + ' should not have a "prototype" property');
return;
}
assert_own_property(window[this.name], "prototype",
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// ". . . the property exists on the interface prototype object."
var interfacePrototypeObject = window[this.name].prototype;
assert_own_property(window[this.name].prototype, "toString",
var interfacePrototypeObject = self[this.name].prototype;
assert_own_property(self[this.name].prototype, "toString",
"interface prototype object missing non-static operation");
var desc = Object.getOwnPropertyDescriptor(interfacePrototypeObject, "toString");
@ -1422,7 +1422,7 @@ IdlInterface.prototype.test_member_stringifier = function(member)
// "Let O be the result of calling ToObject on the this value."
assert_throws(new TypeError(), function() {
window[this.name].prototype.toString.apply(null, []);
self[this.name].prototype.toString.apply(null, []);
}, "calling stringifier with this = null didn't throw TypeError");
// "If O is not an object that implements the interface on which the
@ -1431,7 +1431,7 @@ IdlInterface.prototype.test_member_stringifier = function(member)
// TODO: Test a platform object that implements some other
// interface. (Have to be sure to get inheritance right.)
assert_throws(new TypeError(), function() {
window[this.name].prototype.toString.apply({}, []);
self[this.name].prototype.toString.apply({}, []);
}, "calling stringifier with this = {} didn't throw TypeError");
}.bind(this), this.name + " interface: stringifier");
};
@ -1533,9 +1533,9 @@ IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception
{
assert_equals(exception, null, "Unexpected exception when evaluating object");
assert_equals(typeof obj, expected_typeof, "wrong typeof object");
assert_own_property(window, this.name,
"window does not have own property " + format_value(this.name));
assert_own_property(window[this.name], "prototype",
assert_own_property(self, this.name,
"self does not have own property " + format_value(this.name));
assert_own_property(self[this.name], "prototype",
'interface "' + this.name + '" does not have own property "prototype"');
// "The value of the internal [[Prototype]] property of the
@ -1543,7 +1543,7 @@ IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception
// interface from the platform objects associated global
// environment."
assert_equals(Object.getPrototypeOf(obj),
window[this.name].prototype,
self[this.name].prototype,
desc + "'s prototype is not " + this.name + ".prototype");
}.bind(this), this.name + " must be primary interface of " + desc);
}

View File

@ -920,5 +920,5 @@
};
if (inNode) module.exports = obj;
else window.WebIDL2 = obj;
else self.WebIDL2 = obj;
}());

View File

@ -0,0 +1,116 @@
// -----------------------------------------------------------------------------
// URL
// -----------------------------------------------------------------------------
[NoInterfaceObject/*,
Exposed=(Window,Worker)*/]
interface URLUtilsReadOnly {
stringifier readonly attribute USVString href;
readonly attribute USVString origin;
readonly attribute USVString protocol;
readonly attribute USVString host;
readonly attribute USVString hostname;
readonly attribute USVString port;
readonly attribute USVString pathname;
readonly attribute USVString search;
readonly attribute USVString hash;
};
// -----------------------------------------------------------------------------
// DOM
// -----------------------------------------------------------------------------
//[Exposed=Window,Worker]
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
boolean dispatchEvent(Event event);
};
callback interface EventListener {
void handleEvent(Event event);
};
// -----------------------------------------------------------------------------
// HTML
// -----------------------------------------------------------------------------
[TreatNonCallableAsNull]
callback EventHandlerNonNull = any (Event event);
typedef EventHandlerNonNull? EventHandler;
[TreatNonCallableAsNull]
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
//[Exposed=Worker]
interface WorkerGlobalScope : EventTarget {
readonly attribute WorkerGlobalScope self;
readonly attribute WorkerLocation location;
void close();
attribute OnErrorEventHandler onerror;
attribute EventHandler onlanguagechange;
attribute EventHandler onoffline;
attribute EventHandler ononline;
};
[Global/*=(Worker,DedicatedWorker),Exposed=DedicatedWorker*/]
/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
void postMessage(any message, optional sequence<Transferable> transfer);
attribute EventHandler onmessage;
};
//[Exposed=Worker]
partial interface WorkerGlobalScope { // not obsolete
void importScripts(DOMString... urls);
readonly attribute WorkerNavigator navigator;
};
WorkerGlobalScope implements WindowTimers;
WorkerGlobalScope implements WindowBase64;
[NoInterfaceObject/*, Exposed=(Window,Worker)*/]
interface WindowTimers {
long setTimeout(Function handler, optional long timeout = 0, any... arguments);
long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
void clearTimeout(optional long handle = 0);
long setInterval(Function handler, optional long timeout = 0, any... arguments);
long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
void clearInterval(optional long handle = 0);
};
[NoInterfaceObject/*, Exposed=(Window,Worker)*/]
interface WindowBase64 {
DOMString btoa(DOMString btoa);
DOMString atob(DOMString atob);
};
//[Exposed=Worker]
interface WorkerNavigator {};
WorkerNavigator implements NavigatorID;
WorkerNavigator implements NavigatorLanguage;
WorkerNavigator implements NavigatorOnLine;
[NoInterfaceObject/*, Exposed=(Window,Worker)*/]
interface NavigatorID {
readonly attribute DOMString appCodeName; // constant "Mozilla"
readonly attribute DOMString appName;
readonly attribute DOMString appVersion;
readonly attribute DOMString platform;
readonly attribute DOMString product; // constant "Gecko"
boolean taintEnabled(); // constant false
readonly attribute DOMString userAgent;
};
[NoInterfaceObject/*, Exposed=(Window,Worker)*/]
interface NavigatorLanguage {
readonly attribute DOMString? language;
readonly attribute DOMString[] languages;
};
[NoInterfaceObject/*, Exposed=(Window,Worker)*/]
interface NavigatorOnLine {
readonly attribute boolean onLine;
};
//[Exposed=Worker]
interface WorkerLocation { };
WorkerLocation implements URLUtilsReadOnly;

View File

@ -0,0 +1,20 @@
"use strict";
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
var request = new XMLHttpRequest();
request.onload = function() {
var idlArray = new IdlArray();
var idls = request.responseText;
idlArray.add_idls(idls);
idlArray.add_objects({
DedicatedWorkerGlobalScope: ['self'],
WorkerNavigator: ['self.navigator'],
WorkerLocation: ['self.location'],
});
idlArray.test();
done();
};
request.open("GET", "interfaces.idl");
request.send();

View File

@ -1,29 +0,0 @@
<!--
var unexpected = 'AbstractView AbstractWorker ApplicationCache Location Navigator DOMImplementation Audio HTMLCanvasElement MouseEvent'.split(' ');
var log = [];
for (var i = 0; i < unexpected.length; ++i) {
if (unexpected[i] in self)
log.push(unexpected[i]);
}
postMessage(log.join(', '));
/*
-->
<!doctype html>
<title>unavailable interface objects in dedicated worker</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
async_test(function() {
var worker = new Worker('#');
worker.onmessage = this.step_func(function(e) {
assert_equals(e.data, '', 'these interface objects were not expected');
this.done();
});
});
</script>
<!--
*/
//-->

View File

@ -0,0 +1,18 @@
importScripts("/resources/testharness.js");
var unexpected = [
"AbstractView",
"AbstractWorker",
"ApplicationCache",
"Location",
"Navigator",
"DOMImplementation",
"Audio",
"HTMLCanvasElement",
"MouseEvent",
];
for (var i = 0; i < unexpected.length; ++i) {
test(function () {
assert_false(unexpected[i] in self);
}, "The " + unexpected[i] + " interface object should not be exposed.");
}
done();