mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 18:17:29 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
106
dom/imptests/README
Normal file
106
dom/imptests/README
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
This directory contains tests imported from W3C test suites. In order to make it
|
||||
as easy as possible to update these tests, no changes are made to the imported
|
||||
files (names for scripted tests do get a test_ prefix to integrate with the test
|
||||
runner, however). The scripts to update tests are provided.
|
||||
|
||||
|
||||
=======================
|
||||
Files in this directory
|
||||
=======================
|
||||
|
||||
Source; Usage and purpose; License
|
||||
|
||||
* testharness.js / testharness.css
|
||||
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
|
||||
with the updateTestharness.py script.
|
||||
Provide the test harness.
|
||||
W3C Test Suite License / W3C 3-clause BSD License
|
||||
|
||||
* idlharness.js
|
||||
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
|
||||
with the updateTestharness.py script.
|
||||
Used to test WebIDL.
|
||||
W3C Test Suite License / W3C 3-clause BSD License
|
||||
|
||||
* WebIDLParser.js
|
||||
Directly imported from the W3C repository (<http://dvcs.w3.org/hg/resources>),
|
||||
with the updateTestharness.py script.
|
||||
Used by idlharness.js to parse IDL blocks.
|
||||
MIT License
|
||||
|
||||
* updateTestharness.py
|
||||
Used to update the above files.
|
||||
MPL
|
||||
|
||||
* parseManifest.py
|
||||
Imported from <https://bitbucket.org/ms2ger/test-runner>. Parses MANIFEST
|
||||
files (provided in the W3C repository) as documented at
|
||||
<https://bitbucket.org/ms2ger/test-runner/raw/tip/manifests.txt>.
|
||||
MIT License
|
||||
|
||||
* testharnessreport.js
|
||||
Glue between testharness.js and our Mochitest runner.
|
||||
MPL
|
||||
|
||||
* importTestsuite.py
|
||||
Imports a test suite from a remote repository. Takes one argument, a file in
|
||||
the format described under webapps.txt.
|
||||
Note: removes both source and destination directory before starting. Do not
|
||||
use with outstanding changes in either directory.
|
||||
MPL
|
||||
|
||||
* parseFailures.py
|
||||
Parses failures out of a mochitest log and writes out JSON files and Makefiles
|
||||
into the correct failures/ folder.
|
||||
The mochitest log should be produced by setting the 'dumpFailures' flag in
|
||||
testharnessreport.js; this will print out the encountered failures, marked
|
||||
by @ signs.
|
||||
MPL
|
||||
|
||||
* writeBuildFiles.py
|
||||
Helper functions to write out automatically generated build files.
|
||||
MPL
|
||||
|
||||
* Makefile.in
|
||||
Integration with our build system. Installs support files into /resources and
|
||||
includes a .mk file for each repository.
|
||||
MPL
|
||||
|
||||
* failures/
|
||||
Expected failures for tests in each repository. Each test's failures, if
|
||||
any, are in a file with the same path and name with .json appended. New
|
||||
expected fail files currently needed to be added manually to makefiles.
|
||||
|
||||
* html.mk / webapps.mk / ...
|
||||
Generated by importTestsuite.py from webapps.txt.
|
||||
Contains a list of the directories with tests. To be included in Makefile.in.
|
||||
|
||||
* html.txt / webapps.txt / ...
|
||||
Input to importTestsuite.py.
|
||||
Lists the URL of the repository and the destination directory (separated by a
|
||||
vertical bar), followed by a list of directories within the repository
|
||||
(separated by line feeds).
|
||||
|
||||
* html / webapps / ...
|
||||
Actual tests.
|
||||
W3C Test Suite License / W3C 3-clause BSD License
|
||||
|
||||
|
||||
=====================================================================
|
||||
Importing an additional directory from an already-imported repository
|
||||
=====================================================================
|
||||
|
||||
Add a line to the relevant data file (e.g. webapps.txt), with the path to the
|
||||
additional directory relative to the root of the remote repository, and then run
|
||||
the importTestsuite.py script, passing the data file as its argument.
|
||||
|
||||
|
||||
==========================
|
||||
Importing a new test suite
|
||||
==========================
|
||||
|
||||
Create a data file in the format documented above, and run the
|
||||
importTestsuite.py script, passing the data file as its argument.
|
||||
This will create a foo.mk file; include this file in dom/imptests/Makefile.in.
|
||||
|
||||
Add any necessary files in failures/.
|
||||
924
dom/imptests/WebIDLParser.js
Normal file
924
dom/imptests/WebIDLParser.js
Normal file
|
|
@ -0,0 +1,924 @@
|
|||
|
||||
|
||||
(function () {
|
||||
var tokenise = function (str) {
|
||||
var tokens = []
|
||||
, re = {
|
||||
"float": /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/
|
||||
, "integer": /^-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/
|
||||
, "identifier": /^[A-Z_a-z][0-9A-Z_a-z]*/
|
||||
, "string": /^"[^"]*"/
|
||||
, "whitespace": /^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/
|
||||
, "other": /^[^\t\n\r 0-9A-Z_a-z]/
|
||||
}
|
||||
, types = []
|
||||
;
|
||||
for (var k in re) types.push(k);
|
||||
while (str.length > 0) {
|
||||
var matched = false;
|
||||
for (var i = 0, n = types.length; i < n; i++) {
|
||||
var type = types[i];
|
||||
str = str.replace(re[type], function (tok) {
|
||||
tokens.push({ type: type, value: tok });
|
||||
matched = true;
|
||||
return "";
|
||||
});
|
||||
if (matched) break;
|
||||
}
|
||||
if (matched) continue;
|
||||
throw new Error("Token stream not progressing");
|
||||
}
|
||||
return tokens;
|
||||
};
|
||||
|
||||
var parse = function (tokens, opt) {
|
||||
var line = 1;
|
||||
tokens = tokens.slice();
|
||||
|
||||
var FLOAT = "float"
|
||||
, INT = "integer"
|
||||
, ID = "identifier"
|
||||
, STR = "string"
|
||||
, OTHER = "other"
|
||||
;
|
||||
|
||||
var WebIDLParseError = function (str, line, input, tokens) {
|
||||
this.message = str;
|
||||
this.line = line;
|
||||
this.input = input;
|
||||
this.tokens = tokens;
|
||||
};
|
||||
WebIDLParseError.prototype.toString = function () {
|
||||
return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" +
|
||||
JSON.stringify(this.tokens, null, 4);
|
||||
};
|
||||
|
||||
var error = function (str) {
|
||||
var tok = "", numTokens = 0, maxTokens = 5;
|
||||
while (numTokens < maxTokens && tokens.length > numTokens) {
|
||||
tok += tokens[numTokens].value;
|
||||
numTokens++;
|
||||
}
|
||||
throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5));
|
||||
};
|
||||
|
||||
var last_token = null;
|
||||
|
||||
var consume = function (type, value) {
|
||||
if (!tokens.length || tokens[0].type !== type) return;
|
||||
if (typeof value === "undefined" || tokens[0].value === value) {
|
||||
last_token = tokens.shift();
|
||||
if (type === ID) last_token.value = last_token.value.replace(/^_/, "");
|
||||
return last_token;
|
||||
}
|
||||
};
|
||||
|
||||
var ws = function () {
|
||||
if (!tokens.length) return;
|
||||
if (tokens[0].type === "whitespace") {
|
||||
var t = tokens.shift();
|
||||
t.value.replace(/\n/g, function (m) { line++; return m; });
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
var all_ws = function (store, pea) { // pea == post extended attribute, tpea = same for types
|
||||
var t = { type: "whitespace", value: "" };
|
||||
while (true) {
|
||||
var w = ws();
|
||||
if (!w) break;
|
||||
t.value += w.value;
|
||||
}
|
||||
if (t.value.length > 0) {
|
||||
if (store) {
|
||||
var w = t.value
|
||||
, re = {
|
||||
"ws": /^([\t\n\r ]+)/
|
||||
, "line-comment": /^\/\/(.*)\n?/m
|
||||
, "multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
|
||||
}
|
||||
, wsTypes = []
|
||||
;
|
||||
for (var k in re) wsTypes.push(k);
|
||||
while (w.length) {
|
||||
var matched = false;
|
||||
for (var i = 0, n = wsTypes.length; i < n; i++) {
|
||||
var type = wsTypes[i];
|
||||
w = w.replace(re[type], function (tok, m1) {
|
||||
store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
|
||||
matched = true;
|
||||
return "";
|
||||
});
|
||||
if (matched) break;
|
||||
}
|
||||
if (matched) continue;
|
||||
throw new Error("Surprising white space construct."); // this shouldn't happen
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
var integer_type = function () {
|
||||
var ret = "";
|
||||
all_ws();
|
||||
if (consume(ID, "unsigned")) ret = "unsigned ";
|
||||
all_ws();
|
||||
if (consume(ID, "short")) return ret + "short";
|
||||
if (consume(ID, "long")) {
|
||||
ret += "long";
|
||||
all_ws();
|
||||
if (consume(ID, "long")) return ret + " long";
|
||||
return ret;
|
||||
}
|
||||
if (ret) error("Failed to parse integer type");
|
||||
};
|
||||
|
||||
var float_type = function () {
|
||||
var ret = "";
|
||||
all_ws();
|
||||
if (consume(ID, "unrestricted")) ret = "unrestricted ";
|
||||
all_ws();
|
||||
if (consume(ID, "float")) return ret + "float";
|
||||
if (consume(ID, "double")) return ret + "double";
|
||||
if (ret) error("Failed to parse float type");
|
||||
};
|
||||
|
||||
var primitive_type = function () {
|
||||
var num_type = integer_type() || float_type();
|
||||
if (num_type) return num_type;
|
||||
all_ws();
|
||||
if (consume(ID, "boolean")) return "boolean";
|
||||
if (consume(ID, "byte")) return "byte";
|
||||
if (consume(ID, "octet")) return "octet";
|
||||
};
|
||||
|
||||
var const_value = function () {
|
||||
if (consume(ID, "true")) return { type: "boolean", value: true };
|
||||
if (consume(ID, "false")) return { type: "boolean", value: false };
|
||||
if (consume(ID, "null")) return { type: "null" };
|
||||
if (consume(ID, "Infinity")) return { type: "Infinity", negative: false };
|
||||
if (consume(ID, "NaN")) return { type: "NaN" };
|
||||
var ret = consume(FLOAT) || consume(INT);
|
||||
if (ret) return { type: "number", value: 1 * ret.value };
|
||||
var tok = consume(OTHER, "-");
|
||||
if (tok) {
|
||||
if (consume(ID, "Infinity")) return { type: "Infinity", negative: true };
|
||||
else tokens.unshift(tok);
|
||||
}
|
||||
};
|
||||
|
||||
var type_suffix = function (obj) {
|
||||
while (true) {
|
||||
all_ws();
|
||||
if (consume(OTHER, "?")) {
|
||||
if (obj.nullable) error("Can't nullable more than once");
|
||||
obj.nullable = true;
|
||||
}
|
||||
else if (consume(OTHER, "[")) {
|
||||
all_ws();
|
||||
consume(OTHER, "]") || error("Unterminated array type");
|
||||
if (!obj.array) {
|
||||
obj.array = 1;
|
||||
obj.nullableArray = [obj.nullable];
|
||||
}
|
||||
else {
|
||||
obj.array++;
|
||||
obj.nullableArray.push(obj.nullable);
|
||||
}
|
||||
obj.nullable = false;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
};
|
||||
|
||||
var single_type = function () {
|
||||
var prim = primitive_type()
|
||||
, ret = { sequence: false, generic: null, nullable: false, array: false, union: false }
|
||||
, name
|
||||
, value
|
||||
;
|
||||
if (prim) {
|
||||
ret.idlType = prim;
|
||||
}
|
||||
else if (name = consume(ID)) {
|
||||
value = name.value;
|
||||
all_ws();
|
||||
// Generic types
|
||||
if (consume(OTHER, "<")) {
|
||||
// backwards compat
|
||||
if (value === "sequence") {
|
||||
ret.sequence = true;
|
||||
}
|
||||
ret.generic = value;
|
||||
ret.idlType = type() || error("Error parsing generic type " + value);
|
||||
all_ws();
|
||||
if (!consume(OTHER, ">")) error("Unterminated generic type " + value);
|
||||
all_ws();
|
||||
if (consume(OTHER, "?")) ret.nullable = true;
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
ret.idlType = value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
type_suffix(ret);
|
||||
if (ret.nullable && !ret.array && ret.idlType === "any") error("Type any cannot be made nullable");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var union_type = function () {
|
||||
all_ws();
|
||||
if (!consume(OTHER, "(")) return;
|
||||
var ret = { sequence: false, generic: null, nullable: false, array: false, union: true, idlType: [] };
|
||||
var fst = type() || error("Union type with no content");
|
||||
ret.idlType.push(fst);
|
||||
while (true) {
|
||||
all_ws();
|
||||
if (!consume(ID, "or")) break;
|
||||
var typ = type() || error("No type after 'or' in union type");
|
||||
ret.idlType.push(typ);
|
||||
}
|
||||
if (!consume(OTHER, ")")) error("Unterminated union type");
|
||||
type_suffix(ret);
|
||||
return ret;
|
||||
};
|
||||
|
||||
var type = function () {
|
||||
return single_type() || union_type();
|
||||
};
|
||||
|
||||
var argument = function (store) {
|
||||
var ret = { optional: false, variadic: false };
|
||||
ret.extAttrs = extended_attrs(store);
|
||||
all_ws(store, "pea");
|
||||
var opt_token = consume(ID, "optional");
|
||||
if (opt_token) {
|
||||
ret.optional = true;
|
||||
all_ws();
|
||||
}
|
||||
ret.idlType = type();
|
||||
if (!ret.idlType) {
|
||||
if (opt_token) tokens.unshift(opt_token);
|
||||
return;
|
||||
}
|
||||
var type_token = last_token;
|
||||
if (!ret.optional) {
|
||||
all_ws();
|
||||
if (tokens.length >= 3 &&
|
||||
tokens[0].type === "other" && tokens[0].value === "." &&
|
||||
tokens[1].type === "other" && tokens[1].value === "." &&
|
||||
tokens[2].type === "other" && tokens[2].value === "."
|
||||
) {
|
||||
tokens.shift();
|
||||
tokens.shift();
|
||||
tokens.shift();
|
||||
ret.variadic = true;
|
||||
}
|
||||
}
|
||||
all_ws();
|
||||
var name = consume(ID);
|
||||
if (!name) {
|
||||
if (opt_token) tokens.unshift(opt_token);
|
||||
tokens.unshift(type_token);
|
||||
return;
|
||||
}
|
||||
ret.name = name.value;
|
||||
if (ret.optional) {
|
||||
all_ws();
|
||||
ret["default"] = default_();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var argument_list = function (store) {
|
||||
var ret = []
|
||||
, arg = argument(store ? ret : null)
|
||||
;
|
||||
if (!arg) return;
|
||||
ret.push(arg);
|
||||
while (true) {
|
||||
all_ws(store ? ret : null);
|
||||
if (!consume(OTHER, ",")) return ret;
|
||||
var nxt = argument(store ? ret : null) || error("Trailing comma in arguments list");
|
||||
ret.push(nxt);
|
||||
}
|
||||
};
|
||||
|
||||
var type_pair = function () {
|
||||
all_ws();
|
||||
var k = type();
|
||||
if (!k) return;
|
||||
all_ws()
|
||||
if (!consume(OTHER, ",")) return;
|
||||
all_ws();
|
||||
var v = type();
|
||||
if (!v) return;
|
||||
return [k, v];
|
||||
};
|
||||
|
||||
var simple_extended_attr = function (store) {
|
||||
all_ws();
|
||||
var name = consume(ID);
|
||||
if (!name) return;
|
||||
var ret = {
|
||||
name: name.value
|
||||
, "arguments": null
|
||||
};
|
||||
all_ws();
|
||||
var eq = consume(OTHER, "=");
|
||||
if (eq) {
|
||||
all_ws();
|
||||
ret.rhs = consume(ID);
|
||||
if (!ret.rhs) return error("No right hand side to extended attribute assignment");
|
||||
}
|
||||
all_ws();
|
||||
if (consume(OTHER, "(")) {
|
||||
var args, pair;
|
||||
// [Constructor(DOMString str)]
|
||||
if (args = argument_list(store)) {
|
||||
ret["arguments"] = args;
|
||||
}
|
||||
// [MapClass(DOMString, DOMString)]
|
||||
else if (pair = type_pair()) {
|
||||
ret.typePair = pair;
|
||||
}
|
||||
// [Constructor()]
|
||||
else {
|
||||
ret["arguments"] = [];
|
||||
}
|
||||
all_ws();
|
||||
consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair");
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
// Note: we parse something simpler than the official syntax. It's all that ever
|
||||
// seems to be used
|
||||
var extended_attrs = function (store) {
|
||||
var eas = [];
|
||||
all_ws(store);
|
||||
if (!consume(OTHER, "[")) return eas;
|
||||
eas[0] = simple_extended_attr(store) || error("Extended attribute with not content");
|
||||
all_ws();
|
||||
while (consume(OTHER, ",")) {
|
||||
eas.push(simple_extended_attr(store) || error("Trailing comma in extended attribute"));
|
||||
all_ws();
|
||||
}
|
||||
consume(OTHER, "]") || error("No end of extended attribute");
|
||||
return eas;
|
||||
};
|
||||
|
||||
var default_ = function () {
|
||||
all_ws();
|
||||
if (consume(OTHER, "=")) {
|
||||
all_ws();
|
||||
var def = const_value();
|
||||
if (def) {
|
||||
return def;
|
||||
}
|
||||
else {
|
||||
var str = consume(STR) || error("No value for default");
|
||||
str.value = str.value.replace(/^"/, "").replace(/"$/, "");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var const_ = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "const")) return;
|
||||
var ret = { type: "const", nullable: false };
|
||||
all_ws();
|
||||
var typ = primitive_type();
|
||||
if (!typ) {
|
||||
typ = consume(ID) || error("No type for const");
|
||||
typ = typ.value;
|
||||
}
|
||||
ret.idlType = typ;
|
||||
all_ws();
|
||||
if (consume(OTHER, "?")) {
|
||||
ret.nullable = true;
|
||||
all_ws();
|
||||
}
|
||||
var name = consume(ID) || error("No name for const");
|
||||
ret.name = name.value;
|
||||
all_ws();
|
||||
consume(OTHER, "=") || error("No value assignment for const");
|
||||
all_ws();
|
||||
var cnt = const_value();
|
||||
if (cnt) ret.value = cnt;
|
||||
else error("No value for const");
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated const");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var inheritance = function () {
|
||||
all_ws();
|
||||
if (consume(OTHER, ":")) {
|
||||
all_ws();
|
||||
var inh = consume(ID) || error ("No type in inheritance");
|
||||
return inh.value;
|
||||
}
|
||||
};
|
||||
|
||||
var operation_rest = function (ret, store) {
|
||||
all_ws();
|
||||
if (!ret) ret = {};
|
||||
var name = consume(ID);
|
||||
ret.name = name ? name.value : null;
|
||||
all_ws();
|
||||
consume(OTHER, "(") || error("Invalid operation");
|
||||
ret["arguments"] = argument_list(store) || [];
|
||||
all_ws();
|
||||
consume(OTHER, ")") || error("Unterminated operation");
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated operation");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var callback = function (store) {
|
||||
all_ws(store, "pea");
|
||||
var ret;
|
||||
if (!consume(ID, "callback")) return;
|
||||
all_ws();
|
||||
var tok = consume(ID, "interface");
|
||||
if (tok) {
|
||||
tokens.unshift(tok);
|
||||
ret = interface_();
|
||||
ret.type = "callback interface";
|
||||
return ret;
|
||||
}
|
||||
var name = consume(ID) || error("No name for callback");
|
||||
ret = { type: "callback", name: name.value };
|
||||
all_ws();
|
||||
consume(OTHER, "=") || error("No assignment in callback");
|
||||
all_ws();
|
||||
ret.idlType = return_type();
|
||||
all_ws();
|
||||
consume(OTHER, "(") || error("No arguments in callback");
|
||||
ret["arguments"] = argument_list(store) || [];
|
||||
all_ws();
|
||||
consume(OTHER, ")") || error("Unterminated callback");
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated callback");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var attribute = function (store) {
|
||||
all_ws(store, "pea");
|
||||
var grabbed = []
|
||||
, ret = {
|
||||
type: "attribute"
|
||||
, "static": false
|
||||
, stringifier: false
|
||||
, inherit: false
|
||||
, readonly: false
|
||||
};
|
||||
if (consume(ID, "static")) {
|
||||
ret["static"] = true;
|
||||
grabbed.push(last_token);
|
||||
}
|
||||
else if (consume(ID, "stringifier")) {
|
||||
ret.stringifier = true;
|
||||
grabbed.push(last_token);
|
||||
}
|
||||
var w = all_ws();
|
||||
if (w) grabbed.push(w);
|
||||
if (consume(ID, "inherit")) {
|
||||
if (ret["static"] || ret.stringifier) error("Cannot have a static or stringifier inherit");
|
||||
ret.inherit = true;
|
||||
grabbed.push(last_token);
|
||||
var w = all_ws();
|
||||
if (w) grabbed.push(w);
|
||||
}
|
||||
if (consume(ID, "readonly")) {
|
||||
ret.readonly = true;
|
||||
grabbed.push(last_token);
|
||||
var w = all_ws();
|
||||
if (w) grabbed.push(w);
|
||||
}
|
||||
if (!consume(ID, "attribute")) {
|
||||
tokens = grabbed.concat(tokens);
|
||||
return;
|
||||
}
|
||||
all_ws();
|
||||
ret.idlType = type() || error("No type in attribute");
|
||||
if (ret.idlType.sequence) error("Attributes cannot accept sequence types");
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name in attribute");
|
||||
ret.name = name.value;
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated attribute");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var return_type = function () {
|
||||
var typ = type();
|
||||
if (!typ) {
|
||||
if (consume(ID, "void")) {
|
||||
return "void";
|
||||
}
|
||||
else error("No return type");
|
||||
}
|
||||
return typ;
|
||||
};
|
||||
|
||||
var operation = function (store) {
|
||||
all_ws(store, "pea");
|
||||
var ret = {
|
||||
type: "operation"
|
||||
, getter: false
|
||||
, setter: false
|
||||
, creator: false
|
||||
, deleter: false
|
||||
, legacycaller: false
|
||||
, "static": false
|
||||
, stringifier: false
|
||||
};
|
||||
while (true) {
|
||||
all_ws();
|
||||
if (consume(ID, "getter")) ret.getter = true;
|
||||
else if (consume(ID, "setter")) ret.setter = true;
|
||||
else if (consume(ID, "creator")) ret.creator = true;
|
||||
else if (consume(ID, "deleter")) ret.deleter = true;
|
||||
else if (consume(ID, "legacycaller")) ret.legacycaller = true;
|
||||
else break;
|
||||
}
|
||||
if (ret.getter || ret.setter || ret.creator || ret.deleter || ret.legacycaller) {
|
||||
all_ws();
|
||||
ret.idlType = return_type();
|
||||
operation_rest(ret, store);
|
||||
return ret;
|
||||
}
|
||||
if (consume(ID, "static")) {
|
||||
ret["static"] = true;
|
||||
ret.idlType = return_type();
|
||||
operation_rest(ret, store);
|
||||
return ret;
|
||||
}
|
||||
else if (consume(ID, "stringifier")) {
|
||||
ret.stringifier = true;
|
||||
all_ws();
|
||||
if (consume(OTHER, ";")) return ret;
|
||||
ret.idlType = return_type();
|
||||
operation_rest(ret, store);
|
||||
return ret;
|
||||
}
|
||||
ret.idlType = return_type();
|
||||
all_ws();
|
||||
if (consume(ID, "iterator")) {
|
||||
all_ws();
|
||||
ret.type = "iterator";
|
||||
if (consume(ID, "object")) {
|
||||
ret.iteratorObject = "object";
|
||||
}
|
||||
else if (consume(OTHER, "=")) {
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No right hand side in iterator");
|
||||
ret.iteratorObject = name.value;
|
||||
}
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated iterator");
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
operation_rest(ret, store);
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
var identifiers = function (arr) {
|
||||
while (true) {
|
||||
all_ws();
|
||||
if (consume(OTHER, ",")) {
|
||||
all_ws();
|
||||
var name = consume(ID) || error("Trailing comma in identifiers list");
|
||||
arr.push(name.value);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
};
|
||||
|
||||
var serialiser = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "serializer")) return;
|
||||
var ret = { type: "serializer" };
|
||||
all_ws();
|
||||
if (consume(OTHER, "=")) {
|
||||
all_ws();
|
||||
if (consume(OTHER, "{")) {
|
||||
ret.patternMap = true;
|
||||
all_ws();
|
||||
var id = consume(ID);
|
||||
if (id && id.value === "getter") {
|
||||
ret.names = ["getter"];
|
||||
}
|
||||
else if (id && id.value === "inherit") {
|
||||
ret.names = ["inherit"];
|
||||
identifiers(ret.names);
|
||||
}
|
||||
else if (id) {
|
||||
ret.names = [id.value];
|
||||
identifiers(ret.names);
|
||||
}
|
||||
else {
|
||||
ret.names = [];
|
||||
}
|
||||
all_ws();
|
||||
consume(OTHER, "}") || error("Unterminated serializer pattern map");
|
||||
}
|
||||
else if (consume(OTHER, "[")) {
|
||||
ret.patternList = true;
|
||||
all_ws();
|
||||
var id = consume(ID);
|
||||
if (id && id.value === "getter") {
|
||||
ret.names = ["getter"];
|
||||
}
|
||||
else if (id) {
|
||||
ret.names = [id.value];
|
||||
identifiers(ret.names);
|
||||
}
|
||||
else {
|
||||
ret.names = [];
|
||||
}
|
||||
all_ws();
|
||||
consume(OTHER, "]") || error("Unterminated serializer pattern list");
|
||||
}
|
||||
else {
|
||||
var name = consume(ID) || error("Invalid serializer");
|
||||
ret.name = name.value;
|
||||
}
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated serializer");
|
||||
return ret;
|
||||
}
|
||||
else if (consume(OTHER, ";")) {
|
||||
// noop, just parsing
|
||||
}
|
||||
else {
|
||||
ret.idlType = return_type();
|
||||
all_ws();
|
||||
ret.operation = operation_rest(null, store);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var interface_ = function (isPartial, store) {
|
||||
all_ws(isPartial ? null : store, "pea");
|
||||
if (!consume(ID, "interface")) return;
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name for interface");
|
||||
var mems = []
|
||||
, ret = {
|
||||
type: "interface"
|
||||
, name: name.value
|
||||
, partial: false
|
||||
, members: mems
|
||||
};
|
||||
if (!isPartial) ret.inheritance = inheritance() || null;
|
||||
all_ws();
|
||||
consume(OTHER, "{") || error("Bodyless interface");
|
||||
while (true) {
|
||||
all_ws(store ? mems : null);
|
||||
if (consume(OTHER, "}")) {
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Missing semicolon after interface");
|
||||
return ret;
|
||||
}
|
||||
var ea = extended_attrs(store ? mems : null);
|
||||
all_ws();
|
||||
var cnt = const_(store ? mems : null);
|
||||
if (cnt) {
|
||||
cnt.extAttrs = ea;
|
||||
ret.members.push(cnt);
|
||||
continue;
|
||||
}
|
||||
var mem = serialiser(store ? mems : null) ||
|
||||
attribute(store ? mems : null) ||
|
||||
operation(store ? mems : null) ||
|
||||
error("Unknown member");
|
||||
mem.extAttrs = ea;
|
||||
ret.members.push(mem);
|
||||
}
|
||||
};
|
||||
|
||||
var partial = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "partial")) return;
|
||||
var thing = dictionary(true, store) ||
|
||||
interface_(true, store) ||
|
||||
error("Partial doesn't apply to anything");
|
||||
thing.partial = true;
|
||||
return thing;
|
||||
};
|
||||
|
||||
var dictionary = function (isPartial, store) {
|
||||
all_ws(isPartial ? null : store, "pea");
|
||||
if (!consume(ID, "dictionary")) return;
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name for dictionary");
|
||||
var mems = []
|
||||
, ret = {
|
||||
type: "dictionary"
|
||||
, name: name.value
|
||||
, partial: false
|
||||
, members: mems
|
||||
};
|
||||
if (!isPartial) ret.inheritance = inheritance() || null;
|
||||
all_ws();
|
||||
consume(OTHER, "{") || error("Bodyless dictionary");
|
||||
while (true) {
|
||||
all_ws(store ? mems : null);
|
||||
if (consume(OTHER, "}")) {
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Missing semicolon after dictionary");
|
||||
return ret;
|
||||
}
|
||||
var ea = extended_attrs(store ? mems : null);
|
||||
all_ws(store ? mems : null, "pea");
|
||||
var typ = type() || error("No type for dictionary member");
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name for dictionary member");
|
||||
ret.members.push({
|
||||
type: "field"
|
||||
, name: name.value
|
||||
, idlType: typ
|
||||
, extAttrs: ea
|
||||
, "default": default_()
|
||||
});
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated dictionary member");
|
||||
}
|
||||
};
|
||||
|
||||
var exception = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "exception")) return;
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name for exception");
|
||||
var mems = []
|
||||
, ret = {
|
||||
type: "exception"
|
||||
, name: name.value
|
||||
, members: mems
|
||||
};
|
||||
ret.inheritance = inheritance() || null;
|
||||
all_ws();
|
||||
consume(OTHER, "{") || error("Bodyless exception");
|
||||
while (true) {
|
||||
all_ws(store ? mems : null);
|
||||
if (consume(OTHER, "}")) {
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Missing semicolon after exception");
|
||||
return ret;
|
||||
}
|
||||
var ea = extended_attrs(store ? mems : null);
|
||||
all_ws(store ? mems : null, "pea");
|
||||
var cnt = const_();
|
||||
if (cnt) {
|
||||
cnt.extAttrs = ea;
|
||||
ret.members.push(cnt);
|
||||
}
|
||||
else {
|
||||
var typ = type();
|
||||
all_ws();
|
||||
var name = consume(ID);
|
||||
all_ws();
|
||||
if (!typ || !name || !consume(OTHER, ";")) error("Unknown member in exception body");
|
||||
ret.members.push({
|
||||
type: "field"
|
||||
, name: name.value
|
||||
, idlType: typ
|
||||
, extAttrs: ea
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var enum_ = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "enum")) return;
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name for enum");
|
||||
var vals = []
|
||||
, ret = {
|
||||
type: "enum"
|
||||
, name: name.value
|
||||
, values: vals
|
||||
};
|
||||
all_ws();
|
||||
consume(OTHER, "{") || error("No curly for enum");
|
||||
var saw_comma = false;
|
||||
while (true) {
|
||||
all_ws(store ? vals : null);
|
||||
if (consume(OTHER, "}")) {
|
||||
all_ws();
|
||||
if (saw_comma) error("Trailing comma in enum");
|
||||
consume(OTHER, ";") || error("No semicolon after enum");
|
||||
return ret;
|
||||
}
|
||||
var val = consume(STR) || error("Unexpected value in enum");
|
||||
ret.values.push(val.value.replace(/"/g, ""));
|
||||
all_ws(store ? vals : null);
|
||||
if (consume(OTHER, ",")) {
|
||||
if (store) vals.push({ type: "," });
|
||||
all_ws(store ? vals : null);
|
||||
saw_comma = true;
|
||||
}
|
||||
else {
|
||||
saw_comma = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var typedef = function (store) {
|
||||
all_ws(store, "pea");
|
||||
if (!consume(ID, "typedef")) return;
|
||||
var ret = {
|
||||
type: "typedef"
|
||||
};
|
||||
all_ws();
|
||||
ret.typeExtAttrs = extended_attrs();
|
||||
all_ws(store, "tpea");
|
||||
ret.idlType = type() || error("No type in typedef");
|
||||
all_ws();
|
||||
var name = consume(ID) || error("No name in typedef");
|
||||
ret.name = name.value;
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("Unterminated typedef");
|
||||
return ret;
|
||||
};
|
||||
|
||||
var implements_ = function (store) {
|
||||
all_ws(store, "pea");
|
||||
var target = consume(ID);
|
||||
if (!target) return;
|
||||
var w = all_ws();
|
||||
if (consume(ID, "implements")) {
|
||||
var ret = {
|
||||
type: "implements"
|
||||
, target: target.value
|
||||
};
|
||||
all_ws();
|
||||
var imp = consume(ID) || error("Incomplete implements statement");
|
||||
ret["implements"] = imp.value;
|
||||
all_ws();
|
||||
consume(OTHER, ";") || error("No terminating ; for implements statement");
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
// rollback
|
||||
tokens.unshift(w);
|
||||
tokens.unshift(target);
|
||||
}
|
||||
};
|
||||
|
||||
var definition = function (store) {
|
||||
return callback(store) ||
|
||||
interface_(false, store) ||
|
||||
partial(store) ||
|
||||
dictionary(false, store) ||
|
||||
exception(store) ||
|
||||
enum_(store) ||
|
||||
typedef(store) ||
|
||||
implements_(store)
|
||||
;
|
||||
};
|
||||
|
||||
var definitions = function (store) {
|
||||
if (!tokens.length) return [];
|
||||
var defs = [];
|
||||
while (true) {
|
||||
var ea = extended_attrs(store ? defs : null)
|
||||
, def = definition(store ? defs : null);
|
||||
if (!def) {
|
||||
if (ea.length) error("Stray extended attributes");
|
||||
break;
|
||||
}
|
||||
def.extAttrs = ea;
|
||||
defs.push(def);
|
||||
}
|
||||
return defs;
|
||||
};
|
||||
var res = definitions(opt.ws);
|
||||
if (tokens.length) error("Unrecognised tokens");
|
||||
return res;
|
||||
};
|
||||
|
||||
var inNode = typeof module !== "undefined" && module.exports
|
||||
, obj = {
|
||||
parse: function (str, opt) {
|
||||
if (!opt) opt = {};
|
||||
var tokens = tokenise(str);
|
||||
return parse(tokens, opt);
|
||||
}
|
||||
};
|
||||
|
||||
if (inNode) module.exports = obj;
|
||||
else self.WebIDL2 = obj;
|
||||
}());
|
||||
26
dom/imptests/editing/mochitest.ini
Normal file
26
dom/imptests/editing/mochitest.ini
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
conformancetest/data.js
|
||||
css/reset.css
|
||||
implementation.js
|
||||
selecttest/common.js
|
||||
selecttest/test-iframe.html
|
||||
tests.js
|
||||
|
||||
[conformancetest/test_event.html]
|
||||
[conformancetest/test_runtest.html]
|
||||
skip-if = toolkit == 'android'
|
||||
[selecttest/test_Document-open.html]
|
||||
[selecttest/test_addRange.html]
|
||||
skip-if = toolkit == 'android' #android(bug 775227)
|
||||
[selecttest/test_collapse.html]
|
||||
[selecttest/test_collapseToStartEnd.html]
|
||||
[selecttest/test_deleteFromDocument.html]
|
||||
[selecttest/test_extend.html]
|
||||
[selecttest/test_getRangeAt.html]
|
||||
[selecttest/test_getSelection.html]
|
||||
[selecttest/test_interfaces.html]
|
||||
[selecttest/test_isCollapsed.html]
|
||||
[selecttest/test_removeAllRanges.html]
|
||||
[selecttest/test_selectAllChildren.html]
|
||||
13
dom/imptests/failures/html/dom/nodes/mochitest.ini
Normal file
13
dom/imptests/failures/html/dom/nodes/mochitest.ini
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
|
||||
|
||||
[test_Document-createElement-namespace.html.json]
|
||||
[test_Document-createElementNS.html.json]
|
||||
[test_Document-getElementsByTagName.html.json]
|
||||
[test_Node-properties.html.json]
|
||||
[test_attributes.html.json]
|
||||
[test_case.html.json]
|
||||
[test_getElementsByClassName-10.xml.json]
|
||||
[test_getElementsByClassName-11.xml.json]
|
||||
7
dom/imptests/failures/html/dom/ranges/mochitest.ini
Normal file
7
dom/imptests/failures/html/dom/ranges/mochitest.ini
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
|
||||
|
||||
[test_Range-insertNode.html.json]
|
||||
[test_Range-surroundContents.html.json]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"0,1: resulting range position for range [paras[0].firstChild, 0, paras[0].firstChild, 0], node paras[0].firstChild": true,
|
||||
"4,2: resulting range position for range [paras[1].firstChild, 0, paras[1].firstChild, 0], node paras[1].firstChild": true,
|
||||
"6,6: resulting range position for range [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node detachedPara1.firstChild": true,
|
||||
"8,4: resulting range position for range [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node foreignPara1.firstChild": true
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"0,1: resulting range position for range [paras[0].firstChild, 0, paras[0].firstChild, 0], node paras[0].firstChild": true,
|
||||
"1,1: resulting range position for range [paras[0].firstChild, 0, paras[0].firstChild, 1], node paras[0].firstChild": true,
|
||||
"2,1: resulting range position for range [paras[0].firstChild, 2, paras[0].firstChild, 8], node paras[0].firstChild": true,
|
||||
"3,1: resulting range position for range [paras[0].firstChild, 2, paras[0].firstChild, 9], node paras[0].firstChild": true,
|
||||
"4,2: resulting range position for range [paras[1].firstChild, 0, paras[1].firstChild, 0], node paras[1].firstChild": true,
|
||||
"5,2: resulting range position for range [paras[1].firstChild, 2, paras[1].firstChild, 9], node paras[1].firstChild": true,
|
||||
"6,6: resulting range position for range [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node detachedPara1.firstChild": true,
|
||||
"7,6: resulting range position for range [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node detachedPara1.firstChild": true,
|
||||
"8,4: resulting range position for range [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node foreignPara1.firstChild": true,
|
||||
"9,4: resulting range position for range [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node foreignPara1.firstChild": true,
|
||||
"37,0: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node paras[0]": true,
|
||||
"37,0: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node paras[0]": true,
|
||||
"37,1: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node paras[0].firstChild": true,
|
||||
"37,1: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node paras[0].firstChild": true,
|
||||
"37,2: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node paras[1].firstChild": true,
|
||||
"37,2: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node paras[1].firstChild": true,
|
||||
"37,3: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node foreignPara1": true,
|
||||
"37,3: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node foreignPara1": true,
|
||||
"37,4: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node foreignPara1.firstChild": true,
|
||||
"37,4: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node foreignPara1.firstChild": true,
|
||||
"37,5: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedPara1": true,
|
||||
"37,5: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedPara1": true,
|
||||
"37,6: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedPara1.firstChild": true,
|
||||
"37,6: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedPara1.firstChild": true,
|
||||
"37,8: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedDiv": true,
|
||||
"37,8: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedDiv": true,
|
||||
"37,10: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node foreignPara2": true,
|
||||
"37,10: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node foreignPara2": true,
|
||||
"37,12: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node xmlElement": true,
|
||||
"37,12: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node xmlElement": true,
|
||||
"37,13: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedTextNode": true,
|
||||
"37,13: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedTextNode": true,
|
||||
"37,14: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node foreignTextNode": true,
|
||||
"37,14: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node foreignTextNode": true,
|
||||
"37,15: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node processingInstruction": true,
|
||||
"37,15: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node processingInstruction": true,
|
||||
"37,16: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedProcessingInstruction": true,
|
||||
"37,16: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedProcessingInstruction": true,
|
||||
"37,17: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node comment": true,
|
||||
"37,17: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node comment": true,
|
||||
"37,18: resulting DOM for range [processingInstruction, 0, processingInstruction, 4], node detachedComment": true,
|
||||
"37,18: resulting range position for range [processingInstruction, 0, processingInstruction, 4], node detachedComment": true
|
||||
}
|
||||
10
dom/imptests/failures/html/dom/test_historical.html.json
Normal file
10
dom/imptests/failures/html/dom/test_historical.html.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Historical DOM features must be removed: CDATASection": true,
|
||||
"Historical DOM features must be removed: createCDATASection": true,
|
||||
"Historical DOM features must be removed: createAttribute": true,
|
||||
"Historical DOM features must be removed: createAttributeNS": true,
|
||||
"Historical DOM features must be removed: getAttributeNode": true,
|
||||
"Historical DOM features must be removed: getAttributeNodeNS": true,
|
||||
"Historical DOM features must be removed: setAttributeNode": true,
|
||||
"Historical DOM features must be removed: removeAttributeNode": true
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"EventTarget method: addEventListener": true,
|
||||
"EventTarget method: removeEventListener": true,
|
||||
"EventTarget method: dispatchEvent": true,
|
||||
"Window readonly attribute: history": true,
|
||||
"Window readonly attribute: parent": true,
|
||||
"Window readonly attribute: frameElement": true,
|
||||
"Window readonly attribute: navigator": true,
|
||||
"Window readonly attribute: external": true,
|
||||
"Window readonly attribute: applicationCache": true,
|
||||
"Window readonly attribute: sessionStorage": true,
|
||||
"Window readonly attribute: localStorage": true,
|
||||
"Window readonly attribute: screen": true,
|
||||
"Window readonly attribute: innerWidth": true,
|
||||
"Window readonly attribute: innerHeight": true,
|
||||
"Window readonly attribute: scrollX": true,
|
||||
"Window readonly attribute: pageXOffset": true,
|
||||
"Window readonly attribute: scrollY": true,
|
||||
"Window readonly attribute: pageYOffset": true,
|
||||
"Window readonly attribute: screenX": true,
|
||||
"Window readonly attribute: screenY": true,
|
||||
"Window readonly attribute: outerWidth": true,
|
||||
"Window readonly attribute: outerHeight": true,
|
||||
"Window attribute: oncancel": true,
|
||||
"Window attribute: onclose": true,
|
||||
"Window attribute: oncuechange": true,
|
||||
"Window attribute: onmousewheel": true,
|
||||
"Window unforgeable attribute: window": true,
|
||||
"Window unforgeable attribute: document": true,
|
||||
"Window unforgeable attribute: top": true
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
|
||||
|
||||
[test_document.title-06.html.json]
|
||||
[test_nameditem-02.html.json]
|
||||
[test_nameditem-03.html.json]
|
||||
[test_nameditem-04.html.json]
|
||||
[test_nameditem-05.html.json]
|
||||
[test_nameditem-06.html.json]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"If there are two imgs, a collection should be returned. (name)": true
|
||||
}
|
||||
6
dom/imptests/failures/html/typedarrays/mochitest.ini
Normal file
6
dom/imptests/failures/html/typedarrays/mochitest.ini
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
|
||||
|
||||
[test_constructors.html.json]
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
{
|
||||
"Constructing interface Int8Array with no arguments should throw.": true,
|
||||
"Constructing interface Uint8Array with no arguments should throw.": true,
|
||||
"Constructing interface Uint8ClampedArray with no arguments should throw.": true,
|
||||
"Constructing interface Int16Array with no arguments should throw.": true,
|
||||
"Constructing interface Uint16Array with no arguments should throw.": true,
|
||||
"Constructing interface Int32Array with no arguments should throw.": true,
|
||||
"Constructing interface Uint32Array with no arguments should throw.": true,
|
||||
"Constructing interface Float32Array with no arguments should throw.": true,
|
||||
"Constructing interface Float64Array with no arguments should throw.": true,
|
||||
"Constructing interface ArrayBuffer with no arguments should throw.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Int8Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Int8Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int8Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Int8Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int8Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Int8Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int8Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Uint8Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Uint8Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint8Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Uint8Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint8Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Uint8Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint8Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Uint8ClampedArray.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Uint8ClampedArray.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint8ClampedArray.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Uint8ClampedArray.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint8ClampedArray.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Uint8ClampedArray.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint8ClampedArray.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Int16Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Int16Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int16Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Int16Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int16Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Int16Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int16Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Uint16Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Uint16Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint16Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Uint16Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint16Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Uint16Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint16Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Int32Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Int32Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int32Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Int32Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int32Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Int32Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int32Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Uint32Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Uint32Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint32Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Uint32Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint32Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Uint32Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint32Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Float32Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Float32Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Float32Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Float32Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Float32Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Float32Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Float32Array.": true,
|
||||
"The argument NaN (0) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument Infinity (1) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument -Infinity (2) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument -0.4 (5) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument -0.9 (6) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument 1.1 (7) should be interpreted as 1 for interface Float64Array.": true,
|
||||
"The argument 2.9 (8) should be interpreted as 2 for interface Float64Array.": true,
|
||||
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Float64Array.": true,
|
||||
"The argument \"1\" (11) should be interpreted as 1 for interface Float64Array.": true,
|
||||
"The argument \"1e2\" (12) should be interpreted as 100 for interface Float64Array.": true,
|
||||
"The argument undefined (13) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument null (14) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument false (15) should be interpreted as 0 for interface Float64Array.": true,
|
||||
"The argument true (16) should be interpreted as 1 for interface Float64Array.": true,
|
||||
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Float64Array.": true
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
|
||||
|
||||
[test_storage_local_security.html.json]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"storage local security test": true
|
||||
}
|
||||
3
dom/imptests/html.txt
Normal file
3
dom/imptests/html.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
git|git://github.com/w3c/web-platform-tests.git|html
|
||||
typedarrays
|
||||
webgl
|
||||
1087
dom/imptests/html/dom/common.js
Normal file
1087
dom/imptests/html/dom/common.js
Normal file
File diff suppressed because it is too large
Load diff
45
dom/imptests/html/dom/test_interface-objects.html
Normal file
45
dom/imptests/html/dom/test_interface-objects.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Interfaces</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testInterfaceDeletable(iface) {
|
||||
test(function() {
|
||||
assert_true(!!window[iface], "Interface should exist.")
|
||||
assert_true(delete window[iface], "The delete operator should return true.")
|
||||
assert_equals(window[iface], undefined, "Interface should be gone.")
|
||||
}, "Should be able to delete " + iface + ".")
|
||||
}
|
||||
var interfaces = [
|
||||
"Event",
|
||||
"CustomEvent",
|
||||
"EventTarget",
|
||||
"Node",
|
||||
"Document",
|
||||
"DOMImplementation",
|
||||
"DocumentFragment",
|
||||
"ProcessingInstruction",
|
||||
"DocumentType",
|
||||
"Element",
|
||||
"Attr",
|
||||
"CharacterData",
|
||||
"Text",
|
||||
"Comment",
|
||||
"NodeIterator",
|
||||
"TreeWalker",
|
||||
"NodeFilter",
|
||||
"NodeList",
|
||||
"HTMLCollection",
|
||||
"DOMStringList",
|
||||
"DOMTokenList",
|
||||
];
|
||||
test(function() {
|
||||
for (var p in window) {
|
||||
interfaces.forEach(function(i) {
|
||||
assert_not_equals(p, i)
|
||||
})
|
||||
}
|
||||
}, "Interface objects properties should not be Enumerable")
|
||||
interfaces.forEach(testInterfaceDeletable);
|
||||
</script>
|
||||
455
dom/imptests/html/dom/test_interfaces.html
Normal file
455
dom/imptests/html/dom/test_interfaces.html
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>DOM IDL tests</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
|
||||
<h1>DOM IDL tests</h1>
|
||||
<div id=log></div>
|
||||
|
||||
<script type=text/plain>
|
||||
[Constructor(DOMString name)]
|
||||
interface DOMError {
|
||||
readonly attribute DOMString name;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, optional EventInit eventInitDict)]
|
||||
interface Event {
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute EventTarget? target;
|
||||
readonly attribute EventTarget? currentTarget;
|
||||
|
||||
const unsigned short NONE = 0;
|
||||
const unsigned short CAPTURING_PHASE = 1;
|
||||
const unsigned short AT_TARGET = 2;
|
||||
const unsigned short BUBBLING_PHASE = 3;
|
||||
readonly attribute unsigned short eventPhase;
|
||||
|
||||
void stopPropagation();
|
||||
void stopImmediatePropagation();
|
||||
|
||||
readonly attribute boolean bubbles;
|
||||
readonly attribute boolean cancelable;
|
||||
void preventDefault();
|
||||
readonly attribute boolean defaultPrevented;
|
||||
|
||||
[Unforgeable] readonly attribute boolean isTrusted;
|
||||
readonly attribute /* DOMTimeStamp */ unsigned long long timeStamp;
|
||||
|
||||
void initEvent(DOMString type, boolean bubbles, boolean cancelable);
|
||||
};
|
||||
|
||||
dictionary EventInit {
|
||||
boolean bubbles = false;
|
||||
boolean cancelable = false;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, optional CustomEventInit eventInitDict)]
|
||||
interface CustomEvent : Event {
|
||||
readonly attribute any detail;
|
||||
|
||||
void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any details);
|
||||
};
|
||||
|
||||
dictionary CustomEventInit : EventInit {
|
||||
any detail = null;
|
||||
};
|
||||
|
||||
interface EventTarget {
|
||||
void addEventListener(DOMString type, EventListener? callback, optional boolean capture);
|
||||
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture);
|
||||
boolean dispatchEvent(Event event);
|
||||
};
|
||||
|
||||
[Callback]
|
||||
interface EventListener {
|
||||
void handleEvent(Event event);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface ParentNode {
|
||||
readonly attribute HTMLCollection children;
|
||||
readonly attribute Element? firstElementChild;
|
||||
readonly attribute Element? lastElementChild;
|
||||
readonly attribute unsigned long childElementCount;
|
||||
|
||||
void prepend((Node or DOMString)... nodes);
|
||||
void append((Node or DOMString)... nodes);
|
||||
};
|
||||
Document implements ParentNode;
|
||||
DocumentFragment implements ParentNode;
|
||||
Element implements ParentNode;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface ChildNode {
|
||||
void before((Node or DOMString)... nodes);
|
||||
void after((Node or DOMString)... nodes);
|
||||
void replace((Node or DOMString)... nodes);
|
||||
void remove();
|
||||
};
|
||||
DocumentType implements ChildNode;
|
||||
Element implements ChildNode;
|
||||
CharacterData implements ChildNode;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface NonDocumentTypeChildNode {
|
||||
readonly attribute Element? previousElementSibling;
|
||||
readonly attribute Element? nextElementSibling;
|
||||
};
|
||||
Element implements NonDocumentTypeChildNode;
|
||||
CharacterData implements NonDocumentTypeChildNode;
|
||||
|
||||
[Constructor(MutationCallback callback)]
|
||||
interface MutationObserver {
|
||||
void observe(Node target, MutationObserverInit options);
|
||||
void disconnect();
|
||||
sequence<MutationRecord> takeRecords();
|
||||
};
|
||||
|
||||
callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
|
||||
|
||||
dictionary MutationObserverInit {
|
||||
boolean childList = false;
|
||||
boolean attributes = false;
|
||||
boolean characterData = false;
|
||||
boolean subtree = false;
|
||||
boolean attributeOldValue = false;
|
||||
boolean characterDataOldValue = false;
|
||||
sequence<DOMString> attributeFilter;
|
||||
};
|
||||
|
||||
interface MutationRecord {
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute Node target;
|
||||
readonly attribute NodeList addedNodes;
|
||||
readonly attribute NodeList removedNodes;
|
||||
readonly attribute Node? previousSibling;
|
||||
readonly attribute Node? nextSibling;
|
||||
readonly attribute DOMString? attributeName;
|
||||
readonly attribute DOMString? attributeNamespace;
|
||||
readonly attribute DOMString? oldValue;
|
||||
};
|
||||
|
||||
interface Node : EventTarget {
|
||||
const unsigned short ELEMENT_NODE = 1;
|
||||
const unsigned short ATTRIBUTE_NODE = 2; // historical
|
||||
const unsigned short TEXT_NODE = 3;
|
||||
const unsigned short CDATA_SECTION_NODE = 4; // historical
|
||||
const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
|
||||
const unsigned short ENTITY_NODE = 6; // historical
|
||||
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
|
||||
const unsigned short COMMENT_NODE = 8;
|
||||
const unsigned short DOCUMENT_NODE = 9;
|
||||
const unsigned short DOCUMENT_TYPE_NODE = 10;
|
||||
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
|
||||
const unsigned short NOTATION_NODE = 12; // historical
|
||||
readonly attribute unsigned short nodeType;
|
||||
readonly attribute DOMString nodeName;
|
||||
|
||||
readonly attribute DOMString? baseURI;
|
||||
|
||||
readonly attribute Document? ownerDocument;
|
||||
readonly attribute Node? parentNode;
|
||||
readonly attribute Element? parentElement;
|
||||
boolean hasChildNodes();
|
||||
readonly attribute NodeList childNodes;
|
||||
readonly attribute Node? firstChild;
|
||||
readonly attribute Node? lastChild;
|
||||
readonly attribute Node? previousSibling;
|
||||
readonly attribute Node? nextSibling;
|
||||
|
||||
attribute DOMString? nodeValue;
|
||||
attribute DOMString? textContent;
|
||||
void normalize();
|
||||
|
||||
Node cloneNode(optional boolean deep);
|
||||
boolean isEqualNode(Node? node);
|
||||
|
||||
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
|
||||
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
|
||||
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
|
||||
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
|
||||
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
|
||||
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
|
||||
unsigned short compareDocumentPosition(Node other);
|
||||
boolean contains(Node? other);
|
||||
|
||||
DOMString? lookupPrefix(DOMString? namespace);
|
||||
DOMString? lookupNamespaceURI(DOMString? prefix);
|
||||
boolean isDefaultNamespace(DOMString? namespace);
|
||||
|
||||
Node insertBefore(Node node, Node? child);
|
||||
Node appendChild(Node node);
|
||||
Node replaceChild(Node node, Node child);
|
||||
Node removeChild(Node child);
|
||||
};
|
||||
|
||||
[Constructor]
|
||||
interface Document : Node {
|
||||
readonly attribute DOMImplementation implementation;
|
||||
readonly attribute DOMString URL;
|
||||
readonly attribute DOMString documentURI;
|
||||
readonly attribute DOMString compatMode;
|
||||
readonly attribute DOMString characterSet;
|
||||
readonly attribute DOMString contentType;
|
||||
|
||||
readonly attribute DocumentType? doctype;
|
||||
readonly attribute Element? documentElement;
|
||||
HTMLCollection getElementsByTagName(DOMString localName);
|
||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
Element? getElementById(DOMString elementId);
|
||||
|
||||
Element createElement(DOMString localName);
|
||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName);
|
||||
DocumentFragment createDocumentFragment();
|
||||
Text createTextNode(DOMString data);
|
||||
Comment createComment(DOMString data);
|
||||
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
|
||||
|
||||
Node importNode(Node node, optional boolean deep);
|
||||
Node adoptNode(Node node);
|
||||
|
||||
Event createEvent(DOMString interface);
|
||||
|
||||
Range createRange();
|
||||
|
||||
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
|
||||
NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow, optional NodeFilter? filter);
|
||||
TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow, optional NodeFilter? filter);
|
||||
};
|
||||
|
||||
interface XMLDocument : Document {};
|
||||
|
||||
interface DOMImplementation {
|
||||
DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
|
||||
XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
|
||||
Document createHTMLDocument(optional DOMString title);
|
||||
|
||||
boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version);
|
||||
};
|
||||
|
||||
[Constructor]
|
||||
interface DocumentFragment : Node {
|
||||
};
|
||||
|
||||
interface DocumentType : Node {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute DOMString publicId;
|
||||
readonly attribute DOMString systemId;
|
||||
};
|
||||
|
||||
interface Element : Node {
|
||||
readonly attribute DOMString? namespaceURI;
|
||||
readonly attribute DOMString? prefix;
|
||||
readonly attribute DOMString localName;
|
||||
readonly attribute DOMString tagName;
|
||||
|
||||
attribute DOMString id;
|
||||
attribute DOMString className;
|
||||
[PutForwards=value]
|
||||
readonly attribute DOMTokenList classList;
|
||||
|
||||
readonly attribute Attr[] attributes;
|
||||
DOMString? getAttribute(DOMString name);
|
||||
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
|
||||
void setAttribute(DOMString name, DOMString value);
|
||||
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
|
||||
void removeAttribute(DOMString name);
|
||||
void removeAttributeNS(DOMString? namespace, DOMString localName);
|
||||
boolean hasAttribute(DOMString name);
|
||||
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
|
||||
|
||||
HTMLCollection getElementsByTagName(DOMString localName);
|
||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
};
|
||||
|
||||
interface Attr {
|
||||
readonly attribute DOMString localName;
|
||||
attribute DOMString value;
|
||||
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute DOMString? namespaceURI;
|
||||
readonly attribute DOMString? prefix;
|
||||
};
|
||||
|
||||
interface CharacterData : Node {
|
||||
[TreatNullAs=EmptyString] attribute DOMString data;
|
||||
readonly attribute unsigned long length;
|
||||
DOMString substringData(unsigned long offset, unsigned long count);
|
||||
void appendData(DOMString data);
|
||||
void insertData(unsigned long offset, DOMString data);
|
||||
void deleteData(unsigned long offset, unsigned long count);
|
||||
void replaceData(unsigned long offset, unsigned long count, DOMString data);
|
||||
};
|
||||
|
||||
[Constructor(optional DOMString data)]
|
||||
interface Text : CharacterData {
|
||||
Text splitText(unsigned long offset);
|
||||
readonly attribute DOMString wholeText;
|
||||
};
|
||||
|
||||
interface ProcessingInstruction : CharacterData {
|
||||
readonly attribute DOMString target;
|
||||
};
|
||||
|
||||
[Constructor(optional DOMString data)]
|
||||
interface Comment : CharacterData {
|
||||
};
|
||||
|
||||
[Constructor]
|
||||
interface Range {
|
||||
readonly attribute Node startContainer;
|
||||
readonly attribute unsigned long startOffset;
|
||||
readonly attribute Node endContainer;
|
||||
readonly attribute unsigned long endOffset;
|
||||
readonly attribute boolean collapsed;
|
||||
readonly attribute Node commonAncestorContainer;
|
||||
|
||||
void setStart(Node refNode, unsigned long offset);
|
||||
void setEnd(Node refNode, unsigned long offset);
|
||||
void setStartBefore(Node refNode);
|
||||
void setStartAfter(Node refNode);
|
||||
void setEndBefore(Node refNode);
|
||||
void setEndAfter(Node refNode);
|
||||
void collapse(optional boolean toStart = false);
|
||||
void selectNode(Node refNode);
|
||||
void selectNodeContents(Node refNode);
|
||||
|
||||
const unsigned short START_TO_START = 0;
|
||||
const unsigned short START_TO_END = 1;
|
||||
const unsigned short END_TO_END = 2;
|
||||
const unsigned short END_TO_START = 3;
|
||||
short compareBoundaryPoints(unsigned short how, Range sourceRange);
|
||||
|
||||
void deleteContents();
|
||||
DocumentFragment extractContents();
|
||||
DocumentFragment cloneContents();
|
||||
void insertNode(Node node);
|
||||
void surroundContents(Node newParent);
|
||||
|
||||
Range cloneRange();
|
||||
void detach();
|
||||
|
||||
boolean isPointInRange(Node node, unsigned long offset);
|
||||
short comparePoint(Node node, unsigned long offset);
|
||||
|
||||
boolean intersectsNode(Node node);
|
||||
|
||||
stringifier;
|
||||
};
|
||||
|
||||
interface NodeIterator {
|
||||
readonly attribute Node root;
|
||||
readonly attribute Node? referenceNode;
|
||||
readonly attribute boolean pointerBeforeReferenceNode;
|
||||
readonly attribute unsigned long whatToShow;
|
||||
readonly attribute NodeFilter? filter;
|
||||
|
||||
Node? nextNode();
|
||||
Node? previousNode();
|
||||
|
||||
void detach();
|
||||
};
|
||||
|
||||
interface TreeWalker {
|
||||
readonly attribute Node root;
|
||||
readonly attribute unsigned long whatToShow;
|
||||
readonly attribute NodeFilter? filter;
|
||||
attribute Node currentNode;
|
||||
|
||||
Node? parentNode();
|
||||
Node? firstChild();
|
||||
Node? lastChild();
|
||||
Node? previousSibling();
|
||||
Node? nextSibling();
|
||||
Node? previousNode();
|
||||
Node? nextNode();
|
||||
};
|
||||
|
||||
[Callback]
|
||||
interface NodeFilter {
|
||||
// Constants for acceptNode()
|
||||
const unsigned short FILTER_ACCEPT = 1;
|
||||
const unsigned short FILTER_REJECT = 2;
|
||||
const unsigned short FILTER_SKIP = 3;
|
||||
|
||||
// Constants for whatToShow
|
||||
const unsigned long SHOW_ALL = 0xFFFFFFFF;
|
||||
const unsigned long SHOW_ELEMENT = 0x1;
|
||||
const unsigned long SHOW_ATTRIBUTE = 0x2; // historical
|
||||
const unsigned long SHOW_TEXT = 0x4;
|
||||
const unsigned long SHOW_CDATA_SECTION = 0x8; // historical
|
||||
const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical
|
||||
const unsigned long SHOW_ENTITY = 0x20; // historical
|
||||
const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
|
||||
const unsigned long SHOW_COMMENT = 0x80;
|
||||
const unsigned long SHOW_DOCUMENT = 0x100;
|
||||
const unsigned long SHOW_DOCUMENT_TYPE = 0x200;
|
||||
const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
|
||||
const unsigned long SHOW_NOTATION = 0x800; // historical
|
||||
|
||||
unsigned short acceptNode(Node node);
|
||||
};
|
||||
|
||||
[ArrayClass]
|
||||
interface NodeList {
|
||||
getter Node? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface HTMLCollection {
|
||||
readonly attribute unsigned long length;
|
||||
getter Element? item(unsigned long index);
|
||||
getter object? namedItem(DOMString name); // only returns Element
|
||||
};
|
||||
|
||||
interface DOMTokenList {
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString? item(unsigned long index);
|
||||
boolean contains(DOMString token);
|
||||
void add(DOMString... tokens);
|
||||
void remove(DOMString... tokens);
|
||||
boolean toggle(DOMString token, optional boolean force);
|
||||
stringifier;
|
||||
attribute DOMString value;
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
"use strict";
|
||||
var xmlDoc, detachedRange, element;
|
||||
var idlArray;
|
||||
setup(function() {
|
||||
xmlDoc = document.implementation.createDocument(null, "", null);
|
||||
detachedRange = document.createRange();
|
||||
detachedRange.detach();
|
||||
element = xmlDoc.createElementNS(null, "test");
|
||||
element.setAttribute("bar", "baz");
|
||||
|
||||
idlArray = new IdlArray();
|
||||
idlArray.add_idls(document.querySelector("script[type=text\\/plain]").textContent);
|
||||
idlArray.add_objects({
|
||||
Event: ['document.createEvent("Event")', 'new Event("foo")'],
|
||||
CustomEvent: ['new CustomEvent("foo")'],
|
||||
XMLDocument: ['xmlDoc'],
|
||||
DOMImplementation: ['document.implementation'],
|
||||
DocumentFragment: ['document.createDocumentFragment()'],
|
||||
DocumentType: ['document.doctype'],
|
||||
Element: ['element'],
|
||||
Attr: ['document.querySelector("[id]").attributes[0]'],
|
||||
Text: ['document.createTextNode("abc")'],
|
||||
ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
|
||||
Comment: ['document.createComment("abc")'],
|
||||
Range: ['document.createRange()', 'detachedRange'],
|
||||
NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
|
||||
TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false)'],
|
||||
NodeList: ['document.querySelectorAll("script")'],
|
||||
HTMLCollection: ['document.body.children'],
|
||||
DOMTokenList: ['document.body.classList'],
|
||||
});
|
||||
});
|
||||
idlArray.test();
|
||||
</script>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Changes to named properties of the window object</title>
|
||||
<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
|
||||
<link rel="author" title="Boris Zbarsky" href="bzbarsky@mit.edu">
|
||||
<link rel="help" href="http://www.whatwg.org/html/#window">
|
||||
<link rel="help" href="http://www.whatwg.org/html/#dom-window-nameditem">
|
||||
<link rel="help" href="http://dev.w3.org/2006/webapi/WebIDL/#named-properties-object">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe name="bar"></iframe>
|
||||
<iframe name="constructor"></iframe>
|
||||
<script>
|
||||
function assert_data_propdesc(pd, Writable, Enumerable, Configurable) {
|
||||
assert_equals(typeof pd, "object");
|
||||
assert_equals(pd.writable, Writable);
|
||||
assert_equals(pd.enumerable, Enumerable);
|
||||
assert_equals(pd.configurable, Configurable);
|
||||
}
|
||||
test(function() {
|
||||
assert_true("bar" in window, "bar not in window");
|
||||
assert_equals(window["bar"],
|
||||
document.getElementsByTagName("iframe")[0].contentWindow);
|
||||
}, "Static name");
|
||||
test(function() {
|
||||
assert_true("bar" in Window.prototype, "bar in Window.prototype");
|
||||
assert_false(Window.prototype.hasOwnProperty("bar"), "Window.prototype.hasOwnProperty(\"bar\")");
|
||||
|
||||
var gsp = Object.getPrototypeOf(Object.getPrototypeOf(window));
|
||||
assert_true("bar" in gsp, "bar in gsp");
|
||||
assert_true(gsp.hasOwnProperty("bar"), "gsp.hasOwnProperty(\"bar\")");
|
||||
assert_data_propdesc(Object.getOwnPropertyDescriptor(gsp, "bar"),
|
||||
true, false, true);
|
||||
}, "Static name on the prototype");
|
||||
test(function() {
|
||||
assert_equals(window.constructor, Window);
|
||||
assert_false(window.hasOwnProperty("constructor"), "window.constructor should not be an own property.");
|
||||
|
||||
var proto = Object.getPrototypeOf(window);
|
||||
assert_equals(proto.constructor, Window);
|
||||
assert_true("constructor" in proto, "constructor in proto");
|
||||
assert_data_propdesc(Object.getOwnPropertyDescriptor(proto, "constructor"),
|
||||
true, false, true);
|
||||
|
||||
var gsp = Object.getPrototypeOf(proto);
|
||||
assert_true("constructor" in gsp, "constructor in gsp");
|
||||
assert_false(gsp.hasOwnProperty("constructor"), "gsp.hasOwnProperty(\"constructor\")");
|
||||
assert_equals(Object.getOwnPropertyDescriptor(gsp, "constructor"), undefined)
|
||||
}, "constructor");
|
||||
var t = async_test("Dynamic name")
|
||||
var t2 = async_test("Ghost name")
|
||||
t.step(function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
iframe.setAttribute("src", "data:text/html,<script>window.name='foo'<\/script>");
|
||||
iframe.onload = function() {
|
||||
t.step(function() {
|
||||
assert_true("foo" in window, "foo not in window");
|
||||
assert_equals(window["foo"], iframe.contentWindow);
|
||||
});
|
||||
t.done();
|
||||
t2.step(function() {
|
||||
assert_false("bar" in window, "bar still in window");
|
||||
assert_equals(window["bar"], undefined);
|
||||
});
|
||||
t2.done();
|
||||
};
|
||||
});
|
||||
</script>
|
||||
104
dom/imptests/html/html/dom/documents/dta/test_nameditem-06.html
Normal file
104
dom/imptests/html/html/dom/documents/dta/test_nameditem-06.html
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Named items: imgs</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="http://www.whatwg.org/html/#dom-document-nameditem">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<img name=test1>
|
||||
|
||||
<img name=test2>
|
||||
<img name=test2>
|
||||
|
||||
<img id=test3>
|
||||
|
||||
<img id=test4>
|
||||
<img id=test4>
|
||||
|
||||
<img name=test5>
|
||||
<img id=test5>
|
||||
|
||||
<img id=test6>
|
||||
<img name=test6>
|
||||
|
||||
<img id=test7 name=fail>
|
||||
|
||||
<img name=test8 id=fail>
|
||||
</div>
|
||||
<script>
|
||||
test(function() {
|
||||
var img = document.getElementsByTagName("img")[0];
|
||||
assert_equals(img.name, "test1");
|
||||
|
||||
assert_true("test1" in document, '"test1" in document should be true');
|
||||
assert_equals(document.test1, img);
|
||||
}, "If there is one img, it should be returned (name)");
|
||||
|
||||
test(function() {
|
||||
var img1 = document.getElementsByTagName("img")[1];
|
||||
assert_equals(img1.name, "test2");
|
||||
var img2 = document.getElementsByTagName("img")[2];
|
||||
assert_equals(img2.name, "test2");
|
||||
|
||||
assert_true("test2" in document, '"test2" in document should be true');
|
||||
var collection = document.test2;
|
||||
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
|
||||
assert_array_equals(collection, [img1, img2]);
|
||||
}, "If there are two imgs, a collection should be returned. (name)");
|
||||
|
||||
test(function() {
|
||||
var img = document.getElementsByTagName("img")[3];
|
||||
assert_equals(img.id, "test3");
|
||||
|
||||
assert_false("test3" in document, '"test3" in document should be false');
|
||||
assert_equals(document.test3, undefined);
|
||||
}, "If there is one img, it should not be returned (id)");
|
||||
|
||||
test(function() {
|
||||
var img1 = document.getElementsByTagName("img")[4];
|
||||
assert_equals(img1.id, "test4");
|
||||
var img2 = document.getElementsByTagName("img")[5];
|
||||
assert_equals(img2.id, "test4");
|
||||
|
||||
assert_false("test4" in document, '"test4" in document should be false');
|
||||
assert_equals(document.test4, undefined);
|
||||
}, "If there are two imgs, nothing should be returned. (id)");
|
||||
|
||||
test(function() {
|
||||
var img1 = document.getElementsByTagName("img")[6];
|
||||
assert_equals(img1.name, "test5");
|
||||
var img2 = document.getElementsByTagName("img")[7];
|
||||
assert_equals(img2.id, "test5");
|
||||
|
||||
assert_true("test5" in document, '"test5" in document should be true');
|
||||
assert_equals(document.test5, img1);
|
||||
}, "If there are two imgs, the one with a name should be returned. (name and id)");
|
||||
|
||||
test(function() {
|
||||
var img1 = document.getElementsByTagName("img")[8];
|
||||
assert_equals(img1.id, "test6");
|
||||
var img2 = document.getElementsByTagName("img")[9];
|
||||
assert_equals(img2.name, "test6");
|
||||
|
||||
assert_true("test6" in document, '"test6" in document should be true');
|
||||
assert_equals(document.test6, img2);
|
||||
}, "If there are two imgs, the one with a name should be returned. (id and name)");
|
||||
|
||||
test(function() {
|
||||
var img = document.getElementsByTagName("img")[10];
|
||||
assert_equals(img.id, "test7");
|
||||
|
||||
assert_true("test7" in document, '"test7" in document should be true');
|
||||
assert_equals(document.test7, img);
|
||||
}, "A name should affect getting an img by id");
|
||||
|
||||
test(function() {
|
||||
var img = document.getElementsByTagName("img")[11];
|
||||
assert_equals(img.name, "test8");
|
||||
|
||||
assert_true("test8" in document, '"test8" in document should be true');
|
||||
assert_equals(document.test8, img);
|
||||
}, "An id shouldn't affect getting an img by name");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
|
||||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
|
||||
== dir_auto-contained-bdi-L.html dir_auto-contained-bdi-L.html
|
||||
== dir_auto-contained-bdi-R.html dir_auto-contained-bdi-R.html
|
||||
== dir_auto-contained-dir_auto-L.html dir_auto-contained-dir_auto-L.html
|
||||
== dir_auto-contained-dir_auto-R.html dir_auto-contained-dir_auto-R.html
|
||||
== dir_auto-contained-dir-L.html dir_auto-contained-dir-L.html
|
||||
== dir_auto-contained-dir-R.html dir_auto-contained-dir-R.html
|
||||
== dir_auto-contained-L.html dir_auto-contained-L.html
|
||||
== dir_auto-contained-R.html dir_auto-contained-R.html
|
||||
== dir_auto-contained-script-L.html dir_auto-contained-script-L.html
|
||||
== dir_auto-contained-script-R.html dir_auto-contained-script-R.html
|
||||
== dir_auto-contained-style-L.html dir_auto-contained-style-L.html
|
||||
== dir_auto-contained-style-R.html dir_auto-contained-style-R.html
|
||||
== dir_auto-contained-textarea-L.html dir_auto-contained-textarea-L.html
|
||||
== dir_auto-contained-textarea-R.html dir_auto-contained-textarea-R.html
|
||||
== dir_auto-EN-L.html dir_auto-EN-L.html
|
||||
== dir_auto-EN-R.html dir_auto-EN-R.html
|
||||
== dir_auto-input-EN-L.html dir_auto-input-EN-L.html
|
||||
== dir_auto-input-EN-R.html dir_auto-input-EN-R.html
|
||||
== dir_auto-input-L.html dir_auto-input-L.html
|
||||
== dir_auto-input-N-EN.html dir_auto-input-N-EN.html
|
||||
== dir_auto-input-N-EN-L.html dir_auto-input-N-EN-L.html
|
||||
== dir_auto-input-N-EN-R.html dir_auto-input-N-EN-R.html
|
||||
== dir_auto-input-N-L.html dir_auto-input-N-L.html
|
||||
== dir_auto-input-N-R.html dir_auto-input-N-R.html
|
||||
== dir_auto-input-R.html dir_auto-input-R.html
|
||||
== dir_auto-input-script-EN-L.html dir_auto-input-script-EN-L.html
|
||||
== dir_auto-input-script-EN-R.html dir_auto-input-script-EN-R.html
|
||||
== dir_auto-input-script-L.html dir_auto-input-script-L.html
|
||||
== dir_auto-input-script-N-EN.html dir_auto-input-script-N-EN.html
|
||||
== dir_auto-input-script-N-EN-L.html dir_auto-input-script-N-EN-L.html
|
||||
== dir_auto-input-script-N-EN-R.html dir_auto-input-script-N-EN-R.html
|
||||
== dir_auto-input-script-N-L.html dir_auto-input-script-N-L.html
|
||||
== dir_auto-input-script-N-R.html dir_auto-input-script-N-R.html
|
||||
== dir_auto-input-script-R.html dir_auto-input-script-R.html
|
||||
== dir_auto-isolate.html dir_auto-isolate.html
|
||||
== dir_auto-L.html dir_auto-L.html
|
||||
== dir_auto-N-EN.html dir_auto-N-EN.html
|
||||
== dir_auto-N-EN-L.html dir_auto-N-EN-L.html
|
||||
== dir_auto-N-EN-R.html dir_auto-N-EN-R.html
|
||||
== dir_auto-N-L.html dir_auto-N-L.html
|
||||
== dir_auto-N-R.html dir_auto-N-R.html
|
||||
== dir_auto-pre-mixed.html dir_auto-pre-mixed.html
|
||||
== dir_auto-pre-N-between-Rs.html dir_auto-pre-N-between-Rs.html
|
||||
== dir_auto-pre-N-EN.html dir_auto-pre-N-EN.html
|
||||
== dir_auto-R.html dir_auto-R.html
|
||||
== dir_auto-textarea-mixed.html dir_auto-textarea-mixed.html
|
||||
fails-if(B2G||Mulet||(Android&&asyncPan)) == dir_auto-textarea-N-between-Rs.html dir_auto-textarea-N-between-Rs.html
|
||||
# B2G scrollbar on opposite side
|
||||
== dir_auto-textarea-N-EN.html dir_auto-textarea-N-EN.html
|
||||
== dir_auto-textarea-script-mixed.html dir_auto-textarea-script-mixed.html
|
||||
fails-if(B2G||Mulet||(Android&&asyncPan)) == dir_auto-textarea-script-N-between-Rs.html dir_auto-textarea-script-N-between-Rs.html
|
||||
# B2G scrollbar on reference only
|
||||
== dir_auto-textarea-script-N-EN.html dir_auto-textarea-script-N-EN.html
|
||||
== lang-xyzzy.html lang-xyzzy.html
|
||||
== lang-xmllang-01.html lang-xmllang-01.html
|
||||
== style-01.html style-01.html
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
|
||||
== dir_auto-contained-bdi-L.html dir_auto-contained-bdi-L-ref.html
|
||||
== dir_auto-contained-bdi-R.html dir_auto-contained-bdi-R-ref.html
|
||||
== dir_auto-contained-dir_auto-L.html dir_auto-contained-dir_auto-L-ref.html
|
||||
== dir_auto-contained-dir_auto-R.html dir_auto-contained-dir_auto-R-ref.html
|
||||
== dir_auto-contained-dir-L.html dir_auto-contained-dir-L-ref.html
|
||||
== dir_auto-contained-dir-R.html dir_auto-contained-dir-R-ref.html
|
||||
== dir_auto-contained-L.html dir_auto-contained-L-ref.html
|
||||
== dir_auto-contained-R.html dir_auto-contained-R-ref.html
|
||||
== dir_auto-contained-script-L.html dir_auto-contained-script-L-ref.html
|
||||
== dir_auto-contained-script-R.html dir_auto-contained-script-R-ref.html
|
||||
== dir_auto-contained-style-L.html dir_auto-contained-style-L-ref.html
|
||||
== dir_auto-contained-style-R.html dir_auto-contained-style-R-ref.html
|
||||
== dir_auto-contained-textarea-L.html dir_auto-contained-textarea-L-ref.html
|
||||
== dir_auto-contained-textarea-R.html dir_auto-contained-textarea-R-ref.html
|
||||
== dir_auto-EN-L.html dir_auto-EN-L-ref.html
|
||||
== dir_auto-EN-R.html dir_auto-EN-R-ref.html
|
||||
== dir_auto-input-EN-L.html dir_auto-input-EN-L-ref.html
|
||||
== dir_auto-input-EN-R.html dir_auto-input-EN-R-ref.html
|
||||
== dir_auto-input-L.html dir_auto-input-L-ref.html
|
||||
== dir_auto-input-N-EN.html dir_auto-input-N-EN-ref.html
|
||||
== dir_auto-input-N-EN-L.html dir_auto-input-N-EN-L-ref.html
|
||||
== dir_auto-input-N-EN-R.html dir_auto-input-N-EN-R-ref.html
|
||||
== dir_auto-input-N-L.html dir_auto-input-N-L-ref.html
|
||||
== dir_auto-input-N-R.html dir_auto-input-N-R-ref.html
|
||||
== dir_auto-input-R.html dir_auto-input-R-ref.html
|
||||
== dir_auto-input-script-EN-L.html dir_auto-input-script-EN-L-ref.html
|
||||
== dir_auto-input-script-EN-R.html dir_auto-input-script-EN-R-ref.html
|
||||
== dir_auto-input-script-L.html dir_auto-input-script-L-ref.html
|
||||
== dir_auto-input-script-N-EN.html dir_auto-input-script-N-EN-ref.html
|
||||
== dir_auto-input-script-N-EN-L.html dir_auto-input-script-N-EN-L-ref.html
|
||||
== dir_auto-input-script-N-EN-R.html dir_auto-input-script-N-EN-R-ref.html
|
||||
== dir_auto-input-script-N-L.html dir_auto-input-script-N-L-ref.html
|
||||
== dir_auto-input-script-N-R.html dir_auto-input-script-N-R-ref.html
|
||||
== dir_auto-input-script-R.html dir_auto-input-script-R-ref.html
|
||||
== dir_auto-isolate.html dir_auto-isolate-ref.html
|
||||
== dir_auto-L.html dir_auto-L-ref.html
|
||||
== dir_auto-N-EN.html dir_auto-N-EN-ref.html
|
||||
== dir_auto-N-EN-L.html dir_auto-N-EN-L-ref.html
|
||||
== dir_auto-N-EN-R.html dir_auto-N-EN-R-ref.html
|
||||
== dir_auto-N-L.html dir_auto-N-L-ref.html
|
||||
== dir_auto-N-R.html dir_auto-N-R-ref.html
|
||||
== dir_auto-pre-mixed.html dir_auto-pre-mixed-ref.html
|
||||
== dir_auto-pre-N-between-Rs.html dir_auto-pre-N-between-Rs-ref.html
|
||||
== dir_auto-pre-N-EN.html dir_auto-pre-N-EN-ref.html
|
||||
== dir_auto-R.html dir_auto-R-ref.html
|
||||
== dir_auto-textarea-mixed.html dir_auto-textarea-mixed-ref.html
|
||||
fails-if(Android&&asyncPan) == dir_auto-textarea-N-between-Rs.html dir_auto-textarea-N-between-Rs-ref.html
|
||||
== dir_auto-textarea-N-EN.html dir_auto-textarea-N-EN-ref.html
|
||||
== dir_auto-textarea-script-mixed.html dir_auto-textarea-script-mixed-ref.html
|
||||
fails-if(Android&&asyncPan) == dir_auto-textarea-script-N-between-Rs.html dir_auto-textarea-script-N-between-Rs-ref.html
|
||||
== dir_auto-textarea-script-N-EN.html dir_auto-textarea-script-N-EN-ref.html
|
||||
== lang-xyzzy.html lang-xyzzy-ref.html
|
||||
== lang-xmllang-01.html lang-xmllang-01-ref.html
|
||||
== style-01.html style-01-ref.html
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
<!doctype html>
|
||||
<title>WeakMap.prototype</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.15.5>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function assert_propdesc(obj, prop, Writable, Enumerable, Configurable) {
|
||||
var propdesc = Object.getOwnPropertyDescriptor(obj, prop);
|
||||
assert_equals(typeof propdesc, "object");
|
||||
assert_equals(propdesc.writable, Writable, "[[Writable]]");
|
||||
assert_equals(propdesc.enumerable, Enumerable, "[[Enumerable]]");
|
||||
assert_equals(propdesc.configurable, Configurable, "[[Configurable]]");
|
||||
}
|
||||
|
||||
function test_length(fun, expected) {
|
||||
test(function() {
|
||||
assert_propdesc(WeakMap.prototype[fun], "length", false, false, false);
|
||||
assert_equals(WeakMap.prototype[fun].length, expected);
|
||||
}, "WeakMap.prototype." + fun + ".length")
|
||||
}
|
||||
|
||||
function test_thisval(fun, args) {
|
||||
// Step 1-2
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
WeakMap.prototype[fun].apply(null, args);
|
||||
});
|
||||
assert_throws(new TypeError(), function() {
|
||||
WeakMap.prototype[fun].apply(undefined, args);
|
||||
});
|
||||
}, "WeakMap.prototype." + fun + ": ToObject on this")
|
||||
// Step 3
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
WeakMap.prototype[fun].apply({}, args);
|
||||
});
|
||||
}, "WeakMap.prototype." + fun + ": this has no [[WeakMapData]] internal property")
|
||||
}
|
||||
|
||||
// In every case, the length property of a built-in Function object described
|
||||
// in this clause has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||
// false, [[Configurable]]: false }. Every other property described in this
|
||||
// clause has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
// [[Configurable]]: true } unless otherwise specified.
|
||||
|
||||
test(function() {
|
||||
assert_equals(Object.getPrototypeOf(WeakMap.prototype), Object.prototype);
|
||||
}, "The value of the [[Prototype]] internal property of the WeakMap prototype object is the standard built-in Object prototype object (15.2.4).")
|
||||
|
||||
// 15.15.5.1 WeakMap.prototype.constructor
|
||||
test(function() {
|
||||
assert_equals(WeakMap.prototype.constructor, WeakMap);
|
||||
assert_propdesc(WeakMap.prototype, "constructor", true, false, true);
|
||||
}, "The initial value of WeakMap.prototype.constructor is the built-in WeakMap constructor.")
|
||||
|
||||
// 15.15.5.2 WeakMap.prototype.delete ( key )
|
||||
test(function() {
|
||||
assert_propdesc(WeakMap.prototype, "delete", true, false, true);
|
||||
test_length("delete", 1);
|
||||
// Step 1-3
|
||||
test_thisval("delete", [{}]);
|
||||
}, "WeakMap.prototype.delete")
|
||||
|
||||
// 15.15.5.3 WeakMap.prototype.get ( key )
|
||||
test(function() {
|
||||
assert_propdesc(WeakMap.prototype, "get", true, false, true);
|
||||
test_length("get", 1);
|
||||
// Step 1-3
|
||||
test_thisval("get", [{}]);
|
||||
|
||||
// Step 8
|
||||
test(function() {
|
||||
var wm = new WeakMap();
|
||||
var key = {};
|
||||
var res = wm.get({}, {});
|
||||
assert_equals(res, undefined);
|
||||
}, "WeakMap.prototype.get: return undefined");
|
||||
}, "WeakMap.prototype.get")
|
||||
|
||||
// 15.14.5.4 Map.prototype.has ( key )
|
||||
test(function() {
|
||||
assert_propdesc(WeakMap.prototype, "has", true, false, true);
|
||||
test_length("has", 1);
|
||||
// Step 1-3
|
||||
test_thisval("has", [{}]);
|
||||
}, "WeakMap.prototype.has")
|
||||
|
||||
// 15.14.5.5 Map.prototype.set ( key , value )
|
||||
test(function() {
|
||||
assert_propdesc(WeakMap.prototype, "set", true, false, true);
|
||||
test_length("set", 2);
|
||||
// Step 1-3
|
||||
test_thisval("set", [{}, {}]);
|
||||
}, "WeakMap.prototype.set")
|
||||
|
||||
// 15.15.5.6 Map.prototype.@@toStringTag
|
||||
test(function() {
|
||||
assert_class_string(new WeakMap(), "WeakMap");
|
||||
assert_class_string(WeakMap.prototype, "WeakMap");
|
||||
}, "WeakMap.prototype.@@toStringTag")
|
||||
</script>
|
||||
24
dom/imptests/html/mochitest.ini
Normal file
24
dom/imptests/html/mochitest.ini
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
webgl/common.js
|
||||
|
||||
[typedarrays/test_constructors.html]
|
||||
[webgl/test_bufferSubData.html]
|
||||
subsuite = gpu
|
||||
skip-if = toolkit == 'android' #android(WebGL)
|
||||
[webgl/test_compressedTexImage2D.html]
|
||||
subsuite = gpu
|
||||
skip-if = toolkit == 'android' #android(WebGL)
|
||||
[webgl/test_compressedTexSubImage2D.html]
|
||||
subsuite = gpu
|
||||
skip-if = true # Bug 1226336
|
||||
[webgl/test_texImage2D.html]
|
||||
subsuite = gpu
|
||||
skip-if = toolkit == 'android' #android(WebGL)
|
||||
[webgl/test_texSubImage2D.html]
|
||||
subsuite = gpu
|
||||
skip-if = toolkit == 'android' #android(WebGL)
|
||||
[webgl/test_uniformMatrixNfv.html]
|
||||
subsuite = gpu
|
||||
skip-if = toolkit == 'android' #android(WebGL)
|
||||
48
dom/imptests/html/typedarrays/test_constructors.html
Normal file
48
dom/imptests/html/typedarrays/test_constructors.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<!doctype html>
|
||||
<title>Typed Array constructors</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/typedarray/specs/latest/#7>
|
||||
<link rel=help href=http://dev.w3.org/2006/webapi/WebIDL/#dfn-overload-resolution-algorithm>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var args = [
|
||||
/* numbers */
|
||||
[NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], // Step 2
|
||||
[-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], // Step 3
|
||||
[1, 1], [-0xF1000000, 0xF000000], // Step 4
|
||||
/* strings */
|
||||
["1", 1], ["1e2", 100],
|
||||
/* null, undefined, booleans */
|
||||
[undefined, 0], [null, 0], [false, 0], [true, 1],
|
||||
/* objects */
|
||||
[{}, 0], [{ length: 2, 0: 0, 1: 0 }, 0], [[0, 0], 2]
|
||||
];
|
||||
var interfaces = [
|
||||
"Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array",
|
||||
"Int32Array", "Uint32Array", "Float32Array", "Float64Array"
|
||||
];
|
||||
|
||||
test(function() {
|
||||
interfaces.concat(["ArrayBuffer", "DataView"]).forEach(function(i) {
|
||||
test(function() {
|
||||
// XXX The spec is wrong here.
|
||||
assert_throws(new TypeError(), function() {
|
||||
new window[i]();
|
||||
});
|
||||
}, "Constructing interface " + i + " with no arguments should throw.");
|
||||
});
|
||||
interfaces.forEach(function(i) {
|
||||
args.forEach(function(arg, j) {
|
||||
var input = arg[0], expected = arg[1];
|
||||
test(function() {
|
||||
var ta = new window[i](input);
|
||||
assert_equals(ta.length, expected);
|
||||
}, "The argument " + format_value(input) + " (" + j + ") should be interpreted as " +
|
||||
expected + " for interface " + i + ".");
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
13
dom/imptests/html/webgl/common.js
Normal file
13
dom/imptests/html/webgl/common.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function getGl() {
|
||||
var c = document.createElement("canvas");
|
||||
var gl = c.getContext("experimental-webgl");
|
||||
assert_true(!!gl, "Should be able to get a context.");
|
||||
return gl;
|
||||
}
|
||||
|
||||
function shouldGenerateGLError(cx, glError, fn) {
|
||||
test(function() {
|
||||
fn();
|
||||
assert_equals(cx.getError(), glError);
|
||||
}, "Calling " + fn + " should generate a " + glError + " error.");
|
||||
}
|
||||
26
dom/imptests/html/webgl/test_bufferSubData.html
Normal file
26
dom/imptests/html/webgl/test_bufferSubData.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<title>bufferSubData</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.5>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var gl = getGl();
|
||||
assert_equals(gl.getError(), WebGLRenderingContext.NO_ERROR);
|
||||
|
||||
var b = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, b);
|
||||
|
||||
var a = new Float32Array(1);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, a, gl.STATIC_DRAW);
|
||||
|
||||
var nan = 0 / 0;
|
||||
gl.bufferSubData(gl.ARRAY_BUFFER, nan, a);
|
||||
|
||||
assert_equals(gl.getError(), WebGLRenderingContext.NO_ERROR);
|
||||
});
|
||||
</script>
|
||||
30
dom/imptests/html/webgl/test_compressedTexImage2D.html
Normal file
30
dom/imptests/html/webgl/test_compressedTexImage2D.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<title>compressedTexImage2D</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
||||
var gl = getGl();
|
||||
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
|
||||
shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
|
||||
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8));
|
||||
});
|
||||
shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
|
||||
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8), null);
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0);
|
||||
});
|
||||
}, "Should throw a TypeError when passing too few arguments.");
|
||||
});
|
||||
</script>
|
||||
30
dom/imptests/html/webgl/test_compressedTexSubImage2D.html
Normal file
30
dom/imptests/html/webgl/test_compressedTexSubImage2D.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<title>compressedTexSubImage2D</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
||||
var gl = getGl();
|
||||
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
|
||||
shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
|
||||
gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT, new Uint8Array(8));
|
||||
});
|
||||
shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
|
||||
gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT, new Uint8Array(8), null);
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT);
|
||||
});
|
||||
}, "Should throw a TypeError when passing too few arguments.");
|
||||
});
|
||||
</script>
|
||||
20
dom/imptests/html/webgl/test_texImage2D.html
Normal file
20
dom/imptests/html/webgl/test_texImage2D.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<title>texImage2D</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var gl = getGl();
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.texImage2D(0, 0, 0, 0, 0, window);
|
||||
});
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.texImage2D(0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
20
dom/imptests/html/webgl/test_texSubImage2D.html
Normal file
20
dom/imptests/html/webgl/test_texSubImage2D.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<title>texSubImage2D</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var gl = getGl();
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.texSubImage2D(0, 0, 0, 0, 0, 0, window);
|
||||
});
|
||||
assert_throws(new TypeError(), function() {
|
||||
gl.texSubImage2D(0, 0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
33
dom/imptests/html/webgl/test_uniformMatrixNfv.html
Normal file
33
dom/imptests/html/webgl/test_uniformMatrixNfv.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<title>uniformMatrix*fv</title>
|
||||
<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
|
||||
<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#WebGLRenderingContext>
|
||||
<link rel=help href=http://dev.w3.org/2006/webapi/WebIDL/#es-boolean>
|
||||
<link rel=help href=http://es5.github.com/#x9.2>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=common.js></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script id="vshader" type="x-shader/x-vertex">
|
||||
uniform mat2 m2;
|
||||
uniform mat3 m3;
|
||||
uniform mat4 m4;
|
||||
</script>
|
||||
<script>
|
||||
var floatArray = function(n) {
|
||||
var a = [];
|
||||
for (var i = 0; i < n; ++i) {
|
||||
a.push(1);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
[2, 3, 4].forEach(function(n) {
|
||||
test(function() {
|
||||
var gl = getGl();
|
||||
var f = "uniformMatrix" + n + "fv";
|
||||
var loc = gl.getUniformLocation(gl.createProgram(), "m" + n);
|
||||
gl[f](loc, { valueOf: function() { throw "Error"; } }, floatArray(n));
|
||||
}, "Should not throw for " + n);
|
||||
});
|
||||
</script>
|
||||
1706
dom/imptests/idlharness.js
Normal file
1706
dom/imptests/idlharness.js
Normal file
File diff suppressed because it is too large
Load diff
189
dom/imptests/importTestsuite.py
Normal file
189
dom/imptests/importTestsuite.py
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
#!/usr/bin/env python
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
"""
|
||||
Imports a test suite from a remote repository. Takes one argument, a file in
|
||||
the format described in README.
|
||||
Note: removes both source and destination directory before starting. Do not
|
||||
use with outstanding changes in either directory.
|
||||
"""
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import parseManifest
|
||||
import writeBuildFiles
|
||||
|
||||
def readManifests(iden, dirs):
|
||||
def parseManifestFile(iden, path):
|
||||
pathstr = "hg-%s/%s/MANIFEST" % (iden, path)
|
||||
subdirs, mochitests, reftests, _, supportfiles = parseManifest.parseManifestFile(pathstr)
|
||||
return subdirs, mochitests, reftests, supportfiles
|
||||
|
||||
data = []
|
||||
for path in dirs:
|
||||
subdirs, mochitests, reftests, supportfiles = parseManifestFile(iden, path)
|
||||
data.append({
|
||||
"path": path,
|
||||
"mochitests": mochitests,
|
||||
"reftests": reftests,
|
||||
"supportfiles": supportfiles,
|
||||
})
|
||||
data.extend(readManifests(iden, ["%s/%s" % (path, d) for d in subdirs]))
|
||||
return data
|
||||
|
||||
|
||||
def getData(confFile):
|
||||
"""This function parses a file of the form
|
||||
(hg or git)|URL of remote repository|identifier for the local directory
|
||||
First directory of tests
|
||||
...
|
||||
Last directory of tests"""
|
||||
vcs = ""
|
||||
url = ""
|
||||
iden = ""
|
||||
directories = []
|
||||
try:
|
||||
with open(confFile, 'r') as fp:
|
||||
first = True
|
||||
for line in fp:
|
||||
if first:
|
||||
vcs, url, iden = line.strip().split("|")
|
||||
first = False
|
||||
else:
|
||||
directories.append(line.strip())
|
||||
finally:
|
||||
return vcs, url, iden, directories
|
||||
|
||||
|
||||
def makePathInternal(a, b):
|
||||
if not b:
|
||||
# Empty directory, i.e., the repository root.
|
||||
return a
|
||||
return "%s/%s" % (a, b)
|
||||
|
||||
|
||||
def makeSourcePath(a, b):
|
||||
"""Make a path in the source (upstream) directory."""
|
||||
return makePathInternal("hg-%s" % a, b)
|
||||
|
||||
|
||||
def makeDestPath(a, b):
|
||||
"""Make a path in the destination (mozilla-central) directory, shortening as
|
||||
appropriate."""
|
||||
def shorten(path):
|
||||
path = path.replace('dom-tree-accessors', 'dta')
|
||||
path = path.replace('document.getElementsByName', 'doc.gEBN')
|
||||
path = path.replace('requirements-for-implementations', 'implreq')
|
||||
path = path.replace('other-elements-attributes-and-apis', 'oeaaa')
|
||||
return path
|
||||
|
||||
return shorten(makePathInternal(a, b))
|
||||
|
||||
|
||||
def extractReftestFiles(reftests):
|
||||
"""Returns the set of files referenced in the reftests argument"""
|
||||
files = set()
|
||||
for line in reftests:
|
||||
files.update([line[1], line[2]])
|
||||
return files
|
||||
|
||||
|
||||
def copy(dest, directories):
|
||||
"""Copy mochitests and support files from the external HG directory to their
|
||||
place in mozilla-central.
|
||||
"""
|
||||
print("Copying tests...")
|
||||
for d in directories:
|
||||
sourcedir = makeSourcePath(dest, d["path"])
|
||||
destdir = makeDestPath(dest, d["path"])
|
||||
os.makedirs(destdir)
|
||||
|
||||
reftestfiles = extractReftestFiles(d["reftests"])
|
||||
|
||||
for mochitest in d["mochitests"]:
|
||||
shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
|
||||
for reftest in sorted(reftestfiles):
|
||||
shutil.copy("%s/%s" % (sourcedir, reftest), "%s/%s" % (destdir, reftest))
|
||||
for support in d["supportfiles"]:
|
||||
shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
|
||||
|
||||
def printBuildFiles(dest, directories):
|
||||
"""Create a mochitest.ini that all the contains tests we import.
|
||||
"""
|
||||
print("Creating manifest...")
|
||||
all_mochitests = set()
|
||||
all_support = set()
|
||||
|
||||
for d in directories:
|
||||
path = makeDestPath(dest, d["path"])
|
||||
|
||||
all_mochitests |= set('%s/test_%s' % (d['path'], mochitest)
|
||||
for mochitest in d['mochitests'])
|
||||
all_support |= set('%s/%s' % (d['path'], p) for p in d['supportfiles'])
|
||||
|
||||
if d["reftests"]:
|
||||
with open(path + "/reftest.list", "w") as fh:
|
||||
result = writeBuildFiles.substReftestList("importTestsuite.py",
|
||||
d["reftests"])
|
||||
fh.write(result)
|
||||
|
||||
manifest_path = dest + '/mochitest.ini'
|
||||
with open(manifest_path, 'w') as fh:
|
||||
result = writeBuildFiles.substManifest('importTestsuite.py',
|
||||
all_mochitests, all_support)
|
||||
fh.write(result)
|
||||
subprocess.check_call(["hg", "add", manifest_path])
|
||||
|
||||
def hgadd(dest, directories):
|
||||
"""Inform hg of the files in |directories|."""
|
||||
print("hg addremoving...")
|
||||
for d in directories:
|
||||
subprocess.check_call(["hg", "addremove", makeDestPath(dest, d)])
|
||||
|
||||
def removeAndCloneRepo(vcs, url, dest):
|
||||
"""Replaces the repo at dest by a fresh clone from url using vcs"""
|
||||
assert vcs in ('hg', 'git')
|
||||
|
||||
print("Removing %s..." % dest)
|
||||
subprocess.check_call(["rm", "-rf", dest])
|
||||
|
||||
print("Cloning %s to %s with %s..." % (url, dest, vcs))
|
||||
subprocess.check_call([vcs, "clone", url, dest])
|
||||
|
||||
def importRepo(confFile):
|
||||
try:
|
||||
vcs, url, iden, directories = getData(confFile)
|
||||
dest = iden
|
||||
hgdest = "hg-%s" % iden
|
||||
|
||||
print("Removing %s..." % dest)
|
||||
subprocess.check_call(["rm", "-rf", dest])
|
||||
|
||||
removeAndCloneRepo(vcs, url, hgdest)
|
||||
|
||||
data = readManifests(iden, directories)
|
||||
print("Going to import %s..." % [d["path"] for d in data])
|
||||
|
||||
copy(dest, data)
|
||||
printBuildFiles(dest, data)
|
||||
hgadd(dest, directories)
|
||||
print("Removing %s again..." % hgdest)
|
||||
subprocess.check_call(["rm", "-rf", hgdest])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e.returncode)
|
||||
finally:
|
||||
print("Done")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Need one argument.")
|
||||
else:
|
||||
importRepo(sys.argv[1])
|
||||
|
||||
23
dom/imptests/moz.build
Normal file
23
dom/imptests/moz.build
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'html/mochitest.ini',
|
||||
'webapps/mochitest.ini',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'failures/html/typedarrays/mochitest.ini',
|
||||
'failures/webapps/WebStorage/tests/submissions/Infraware/mochitest.ini',
|
||||
]
|
||||
|
||||
TEST_HARNESS_FILES.testing.mochitest.resources += [
|
||||
'idlharness.js',
|
||||
'testharness.css',
|
||||
'testharness.js',
|
||||
'testharnessreport.js',
|
||||
'WebIDLParser.js',
|
||||
]
|
||||
79
dom/imptests/parseFailures.py
Normal file
79
dom/imptests/parseFailures.py
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import collections
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import writeBuildFiles
|
||||
|
||||
def extractLines(fp):
|
||||
lines = []
|
||||
watch = False
|
||||
for line in fp:
|
||||
line = line.decode('utf-8')
|
||||
if line == '@@@ @@@ Failures\n':
|
||||
watch = True
|
||||
elif watch:
|
||||
watch = False
|
||||
idx = line.index('@@@')
|
||||
lines.append((line[:idx], line[idx + 3:]))
|
||||
return lines
|
||||
|
||||
def ensuredir(path):
|
||||
dir = path[:path.rfind('/')]
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
|
||||
def dumpFailures(lines):
|
||||
files = []
|
||||
for url, objstr in lines:
|
||||
if objstr == '{}\n':
|
||||
continue
|
||||
|
||||
# Avoid overly large diffs.
|
||||
if 'editing/' in url:
|
||||
sep = ':'
|
||||
else:
|
||||
sep = ': '
|
||||
|
||||
jsonpath = 'failures/' + url + '.json'
|
||||
files.append(jsonpath)
|
||||
ensuredir(jsonpath)
|
||||
obj = json.loads(objstr, object_pairs_hook=collections.OrderedDict)
|
||||
formattedobjstr = json.dumps(obj, indent=2, separators=(',', sep)) + '\n'
|
||||
formattedobj = formattedobjstr.encode('utf-8')
|
||||
fp = open(jsonpath, 'wb')
|
||||
fp.write(formattedobj)
|
||||
fp.close()
|
||||
return files
|
||||
|
||||
def writeFiles(files):
|
||||
pathmap = {}
|
||||
for path in files:
|
||||
dirp, leaf = path.rsplit('/', 1)
|
||||
pathmap.setdefault(dirp, []).append(leaf)
|
||||
|
||||
for k, v in pathmap.items():
|
||||
with open(k + '/mochitest.ini', 'w') as fh:
|
||||
result = writeBuildFiles.substManifest('parseFailures.py', v, [])
|
||||
fh.write(result)
|
||||
|
||||
|
||||
def main(logPath):
|
||||
fp = open(logPath, 'rb')
|
||||
lines = extractLines(fp)
|
||||
fp.close()
|
||||
|
||||
files = dumpFailures(lines)
|
||||
writeFiles(files)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
print("Please pass the path to the logfile from which failures should be extracted.")
|
||||
main(sys.argv[1])
|
||||
|
||||
69
dom/imptests/parseManifest.py
Normal file
69
dom/imptests/parseManifest.py
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# Copyright (C) 2011-2013 Ms2ger
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
|
||||
def parseManifest(fd):
|
||||
def parseReftestLine(chunks):
|
||||
assert len(chunks) % 2 == 0
|
||||
reftests = []
|
||||
for i in range(2, len(chunks), 2):
|
||||
if not chunks[i] in ["==", "!="]:
|
||||
raise Exception("Misformatted reftest line " + line)
|
||||
reftests.append([chunks[i], chunks[1], chunks[i + 1]])
|
||||
return reftests
|
||||
|
||||
dirs = []
|
||||
autotests = []
|
||||
reftests = []
|
||||
othertests = []
|
||||
supportfiles = []
|
||||
for fullline in fd:
|
||||
line = fullline.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
||||
chunks = line.split(" ")
|
||||
|
||||
if chunks[0] == "MANIFEST":
|
||||
raise Exception("MANIFEST listed on line " + line)
|
||||
|
||||
if chunks[0] == "dir":
|
||||
dirs.append(chunks[1])
|
||||
elif chunks[0] == "support" and chunks[1] == "dir":
|
||||
dirs.append(chunks[1])
|
||||
elif chunks[0] == "ref":
|
||||
if len(chunks) % 2:
|
||||
raise Exception("Missing chunk in line " + line)
|
||||
reftests.extend(parseReftestLine(chunks))
|
||||
elif chunks[0] == "support":
|
||||
supportfiles.append(chunks[1])
|
||||
elif chunks[0] in ["manual", "parser", "http"]:
|
||||
othertests.append(chunks[1])
|
||||
else:
|
||||
# automated
|
||||
autotests.append(chunks[0])
|
||||
return dirs, autotests, reftests, othertests, supportfiles
|
||||
|
||||
|
||||
def parseManifestFile(path):
|
||||
fp = open(path)
|
||||
dirs, autotests, reftests, othertests, supportfiles = parseManifest(fp)
|
||||
fp.close()
|
||||
return dirs, autotests, reftests, othertests, supportfiles
|
||||
102
dom/imptests/testharness.css
Normal file
102
dom/imptests/testharness.css
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
html {
|
||||
font-family:DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
|
||||
}
|
||||
|
||||
#log .warning,
|
||||
#log .warning a {
|
||||
color: black;
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
#log .error,
|
||||
#log .error a {
|
||||
color: white;
|
||||
background: red;
|
||||
}
|
||||
|
||||
section#summary {
|
||||
margin-bottom:1em;
|
||||
}
|
||||
|
||||
table#results {
|
||||
border-collapse:collapse;
|
||||
table-layout:fixed;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table#results th:first-child,
|
||||
table#results td:first-child {
|
||||
width:4em;
|
||||
}
|
||||
|
||||
table#results th:last-child,
|
||||
table#results td:last-child {
|
||||
width:50%;
|
||||
}
|
||||
|
||||
table#results.assertions th:last-child,
|
||||
table#results.assertions td:last-child {
|
||||
width:35%;
|
||||
}
|
||||
|
||||
table#results th {
|
||||
padding:0;
|
||||
padding-bottom:0.5em;
|
||||
border-bottom:medium solid black;
|
||||
}
|
||||
|
||||
table#results td {
|
||||
padding:1em;
|
||||
padding-bottom:0.5em;
|
||||
border-bottom:thin solid black;
|
||||
}
|
||||
|
||||
tr.pass > td:first-child {
|
||||
color:green;
|
||||
}
|
||||
|
||||
tr.fail > td:first-child {
|
||||
color:red;
|
||||
}
|
||||
|
||||
tr.timeout > td:first-child {
|
||||
color:red;
|
||||
}
|
||||
|
||||
tr.notrun > td:first-child {
|
||||
color:blue;
|
||||
}
|
||||
|
||||
.pass > td:first-child, .fail > td:first-child, .timeout > td:first-child, .notrun > td:first-child {
|
||||
font-variant:small-caps;
|
||||
}
|
||||
|
||||
table#results span {
|
||||
display:block;
|
||||
}
|
||||
|
||||
table#results span.expected {
|
||||
font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
|
||||
white-space:pre;
|
||||
}
|
||||
|
||||
table#results span.actual {
|
||||
font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
|
||||
white-space:pre;
|
||||
}
|
||||
|
||||
span.ok {
|
||||
color:green;
|
||||
}
|
||||
|
||||
tr.error {
|
||||
color:red;
|
||||
}
|
||||
|
||||
span.timeout {
|
||||
color:red;
|
||||
}
|
||||
|
||||
span.ok, span.timeout, span.error {
|
||||
font-variant:small-caps;
|
||||
}
|
||||
2657
dom/imptests/testharness.js
Normal file
2657
dom/imptests/testharness.js
Normal file
File diff suppressed because it is too large
Load diff
312
dom/imptests/testharnessreport.js
Normal file
312
dom/imptests/testharnessreport.js
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var W3CTest = {
|
||||
/**
|
||||
* Dictionary mapping a test URL to either the string "all", which means that
|
||||
* all tests in this file are expected to fail, or a dictionary mapping test
|
||||
* names to either the boolean |true|, or the string "debug". The former
|
||||
* means that this test is expected to fail in all builds, and the latter
|
||||
* that it is only expected to fail in debug builds.
|
||||
*/
|
||||
"expectedFailures": {},
|
||||
|
||||
/**
|
||||
* If set to true, we will dump the test failures to the console.
|
||||
*/
|
||||
"dumpFailures": false,
|
||||
|
||||
/**
|
||||
* If dumpFailures is true, this holds a structure like necessary for
|
||||
* expectedFailures, for ease of updating the expectations.
|
||||
*/
|
||||
"failures": {},
|
||||
|
||||
/**
|
||||
* List of test results, needed by TestRunner to update the UI.
|
||||
*/
|
||||
"tests": [],
|
||||
|
||||
/**
|
||||
* Number of unlogged passes, to stop buildbot from truncating the log.
|
||||
* We will print a message every MAX_COLLAPSED_MESSAGES passes.
|
||||
*/
|
||||
"collapsedMessages": 0,
|
||||
"MAX_COLLAPSED_MESSAGES": 100,
|
||||
|
||||
/**
|
||||
* Reference to the TestRunner object in the parent frame.
|
||||
*/
|
||||
"runner": parent === this ? null : parent.TestRunner || parent.wrappedJSObject.TestRunner,
|
||||
|
||||
/**
|
||||
* Prefixes for the error logging. Indexed first by int(todo) and second by
|
||||
* int(result). Also contains the test's status, and expected status.
|
||||
*/
|
||||
"prefixes": [
|
||||
[
|
||||
{status: 'FAIL', expected: 'PASS', message: "TEST-UNEXPECTED-FAIL"},
|
||||
{status: 'PASS', expected: 'PASS', message: "TEST-PASS"}
|
||||
],
|
||||
[
|
||||
{status: 'FAIL', expected: 'FAIL', message: "TEST-KNOWN-FAIL"},
|
||||
{status: 'PASS', expected: 'FAIL', message: "TEST-UNEXPECTED-PASS"}
|
||||
]
|
||||
],
|
||||
|
||||
/**
|
||||
* Prefix of the path to parent of the the failures directory.
|
||||
*/
|
||||
"pathprefix": "/tests/dom/imptests/",
|
||||
|
||||
/**
|
||||
* Returns the URL of the current test, relative to the root W3C tests
|
||||
* directory. Used as a key into the expectedFailures dictionary.
|
||||
*/
|
||||
"getPath": function() {
|
||||
var url = this.getURL();
|
||||
if (!url.startsWith(this.pathprefix)) {
|
||||
return "";
|
||||
}
|
||||
return url.substring(this.pathprefix.length);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the root-relative URL of the current test.
|
||||
*/
|
||||
"getURL": function() {
|
||||
return this.runner ? this.runner.currentTestURL : location.pathname;
|
||||
},
|
||||
|
||||
/**
|
||||
* Report the results in the tests array.
|
||||
*/
|
||||
"reportResults": function() {
|
||||
var element = function element(aLocalName) {
|
||||
var xhtmlNS = "http://www.w3.org/1999/xhtml";
|
||||
return document.createElementNS(xhtmlNS, aLocalName);
|
||||
};
|
||||
|
||||
var stylesheet = element("link");
|
||||
stylesheet.setAttribute("rel", "stylesheet");
|
||||
stylesheet.setAttribute("href", "/resources/testharness.css");
|
||||
var heads = document.getElementsByTagName("head");
|
||||
if (heads.length) {
|
||||
heads[0].appendChild(stylesheet);
|
||||
}
|
||||
|
||||
var log = document.getElementById("log");
|
||||
if (!log) {
|
||||
return;
|
||||
}
|
||||
var section = log.appendChild(element("section"));
|
||||
section.id = "summary";
|
||||
section.appendChild(element("h2")).textContent = "Details";
|
||||
|
||||
var table = section.appendChild(element("table"));
|
||||
table.id = "results";
|
||||
|
||||
var tr = table.appendChild(element("thead")).appendChild(element("tr"));
|
||||
for (var header of ["Result", "Test Name", "Message"]) {
|
||||
tr.appendChild(element("th")).textContent = header;
|
||||
}
|
||||
var statuses = [
|
||||
["Unexpected Fail", "Pass"],
|
||||
["Known Fail", "Unexpected Pass"]
|
||||
];
|
||||
var tbody = table.appendChild(element("tbody"));
|
||||
for (var test of this.tests) {
|
||||
tr = tbody.appendChild(element("tr"));
|
||||
tr.className = (test.result === !test.todo ? "pass" : "fail");
|
||||
tr.appendChild(element("td")).textContent =
|
||||
statuses[+test.todo][+test.result];
|
||||
tr.appendChild(element("td")).textContent = test.name;
|
||||
tr.appendChild(element("td")).textContent = test.message;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a printable message based on aTest's 'name' and 'message'
|
||||
* properties.
|
||||
*/
|
||||
"formatTestMessage": function(aTest) {
|
||||
return aTest.name + (aTest.message ? ": " + aTest.message : "");
|
||||
},
|
||||
|
||||
/**
|
||||
* Lets the test runner know about a test result.
|
||||
*/
|
||||
"_log": function(test) {
|
||||
var url = this.getURL();
|
||||
var message = this.formatTestMessage(test);
|
||||
var result = this.prefixes[+test.todo][+test.result];
|
||||
|
||||
if (this.runner) {
|
||||
this.runner.structuredLogger.testStatus(url,
|
||||
test.name,
|
||||
result.status,
|
||||
result.expected,
|
||||
message);
|
||||
} else {
|
||||
var msg = result.message + " | ";
|
||||
if (url) {
|
||||
msg += url;
|
||||
}
|
||||
msg += " | " + this.formatTestMessage(test);
|
||||
dump(msg + "\n");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Logs a message about collapsed messages (if any), and resets the counter.
|
||||
*/
|
||||
"_logCollapsedMessages": function() {
|
||||
if (this.collapsedMessages) {
|
||||
this._log({
|
||||
"name": document.title,
|
||||
"result": true,
|
||||
"todo": false,
|
||||
"message": "Elided " + this.collapsedMessages + " passes or known failures."
|
||||
});
|
||||
}
|
||||
this.collapsedMessages = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Maybe logs a result, eliding up to MAX_COLLAPSED_MESSAGES consecutive
|
||||
* passes.
|
||||
*/
|
||||
"_maybeLog": function(test) {
|
||||
var success = (test.result === !test.todo);
|
||||
if (success && ++this.collapsedMessages < this.MAX_COLLAPSED_MESSAGES) {
|
||||
return;
|
||||
}
|
||||
this._logCollapsedMessages();
|
||||
this._log(test);
|
||||
},
|
||||
|
||||
/**
|
||||
* Reports a test result. The argument is an object with the following
|
||||
* properties:
|
||||
*
|
||||
* o message (string): message to be reported
|
||||
* o result (boolean): whether this test failed
|
||||
* o todo (boolean): whether this test is expected to fail
|
||||
*/
|
||||
"report": function(test) {
|
||||
this.tests.push(test);
|
||||
this._maybeLog(test);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if this test is expected to fail, and false otherwise.
|
||||
*/
|
||||
"_todo": function(test) {
|
||||
if (this.expectedFailures === "all") {
|
||||
return true;
|
||||
}
|
||||
var value = this.expectedFailures[test.name];
|
||||
return value === true || (value === "debug" && !!SpecialPowers.isDebugBuild);
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback function for testharness.js. Called when one test in a file
|
||||
* finishes.
|
||||
*/
|
||||
"result": function(test) {
|
||||
var url = this.getPath();
|
||||
this.report({
|
||||
"name": test.name,
|
||||
"message": test.message || "",
|
||||
"result": test.status === test.PASS,
|
||||
"todo": this._todo(test)
|
||||
});
|
||||
if (this.dumpFailures && test.status !== test.PASS) {
|
||||
this.failures[test.name] = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback function for testharness.js. Called when the entire test file
|
||||
* finishes.
|
||||
*/
|
||||
"finish": function(tests, status) {
|
||||
var url = this.getPath();
|
||||
this.report({
|
||||
"name": "Finished test",
|
||||
"message": "Status: " + status.status,
|
||||
"result": status.status === status.OK,
|
||||
"todo":
|
||||
url in this.expectedFailures &&
|
||||
this.expectedFailures[url] === "error"
|
||||
});
|
||||
|
||||
this._logCollapsedMessages();
|
||||
|
||||
if (this.dumpFailures) {
|
||||
dump("@@@ @@@ Failures\n");
|
||||
dump(url + "@@@" + JSON.stringify(this.failures) + "\n");
|
||||
}
|
||||
if (this.runner) {
|
||||
this.runner.testFinished(this.tests.map(function(aTest) {
|
||||
return {
|
||||
"message": this.formatTestMessage(aTest),
|
||||
"result": aTest.result,
|
||||
"todo": aTest.todo
|
||||
};
|
||||
}, this));
|
||||
} else {
|
||||
this.reportResults();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Log an unexpected failure. Intended to be used from harness code, not
|
||||
* from tests.
|
||||
*/
|
||||
"logFailure": function(aTestName, aMessage) {
|
||||
this.report({
|
||||
"name": aTestName,
|
||||
"message": aMessage,
|
||||
"result": false,
|
||||
"todo": false
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Timeout the current test. Intended to be used from harness code, not
|
||||
* from tests.
|
||||
*/
|
||||
"timeout": function() {
|
||||
this.logFailure("Timeout", "Test runner timed us out.");
|
||||
timeout();
|
||||
}
|
||||
};
|
||||
(function() {
|
||||
try {
|
||||
var path = W3CTest.getPath();
|
||||
if (path) {
|
||||
// Get expected fails. If there aren't any, there will be a 404, which is
|
||||
// fine. Anything else is unexpected.
|
||||
var url = W3CTest.pathprefix + "failures/" + path + ".json";
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", url, false);
|
||||
request.send();
|
||||
if (request.status === 200) {
|
||||
W3CTest.expectedFailures = JSON.parse(request.responseText);
|
||||
} else if (request.status !== 404) {
|
||||
W3CTest.logFailure("Fetching failures file", "Request status was " + request.status);
|
||||
}
|
||||
}
|
||||
|
||||
add_result_callback(W3CTest.result.bind(W3CTest));
|
||||
add_completion_callback(W3CTest.finish.bind(W3CTest));
|
||||
setup({
|
||||
"output": W3CTest.runner && !W3CTest.runner.getParameterInfo().closeWhenDone,
|
||||
"explicit_timeout": true
|
||||
});
|
||||
} catch (e) {
|
||||
W3CTest.logFailure("Harness setup", "Unexpected exception: " + e);
|
||||
}
|
||||
})();
|
||||
25
dom/imptests/updateTestharness.py
Normal file
25
dom/imptests/updateTestharness.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import subprocess
|
||||
|
||||
repo = "https://github.com/w3c/testharness.js"
|
||||
dest = "resources-upstream"
|
||||
files = [{"f":"testharness.js"},
|
||||
{"f":"testharness.css"},
|
||||
{"f":"idlharness.js"},
|
||||
{"d":"webidl2/lib/webidl2.js", "f":"WebIDLParser.js"}]
|
||||
|
||||
subprocess.check_call(["git", "clone", repo, dest])
|
||||
subprocess.check_call(["git", "submodule", "init"], cwd=dest)
|
||||
subprocess.check_call(["git", "submodule", "update"], cwd=dest)
|
||||
for f in files:
|
||||
path = f["d"] if "d" in f else f["f"]
|
||||
subprocess.check_call(["cp", "%s/%s" % (dest, path), f["f"]])
|
||||
subprocess.check_call(["hg", "add", f["f"]])
|
||||
subprocess.check_call(["rm", "-rf", dest])
|
||||
|
||||
3
dom/imptests/webapps.txt
Normal file
3
dom/imptests/webapps.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
hg|https://dvcs.w3.org/hg/webapps|webapps
|
||||
WebStorage/tests/submissions
|
||||
XMLHttpRequest/tests/submissions/Ms2ger
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("name", "user2");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
localStorage.clear();
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage != null){
|
||||
try {
|
||||
localStorage.setItem("Security", "false");
|
||||
parent.localStorage.clear();
|
||||
} catch (e) {
|
||||
if(e.code == e['SECURITY_ERR'])
|
||||
localStorage.setItem("Security", "true");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
localStorage.clear();
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("name", "user2");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
sessionStorage.clear();
|
||||
} else {
|
||||
parent.fail("sessionStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem('name', 'user1');
|
||||
} catch (e) {
|
||||
parent.fail('setItem method is failed.');
|
||||
}
|
||||
sessionStorage.clear();
|
||||
} else {
|
||||
parent.fail('sessionStorage is not supported.');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem('name', 'user1');
|
||||
} catch (e) {
|
||||
parent.fail('setItem method is failed.');
|
||||
}
|
||||
} else {
|
||||
parent.fail('sessionStorage is not supported.');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_Constructor</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.type, 'storage');
|
||||
assert_equals(event.key, null);
|
||||
assert_equals(event.oldValue, null);
|
||||
assert_equals(event.newValue, null);
|
||||
assert_equals(event.url, '');
|
||||
assert_equals(event.storageArea, null);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
var event = new StorageEvent('storage');
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("key property test of local event");
|
||||
var expected = ['name', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_clear_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_newValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("newValue property test of local event");
|
||||
var expected = ['user1', 'user2', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.newValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_oldValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("oldValue property test of local event");
|
||||
var expected = [null, 'user1', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.oldValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_storageArea</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("storageArea property test of local event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.storageArea.length, 1);
|
||||
var key = event.storageArea.key(0);
|
||||
var value = event.storageArea.getItem(key);
|
||||
assert_equals(key, "name");
|
||||
assert_equals(value, "user1");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_StorageEventInit</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, 'key');
|
||||
assert_equals(event.oldValue, 'oldValue');
|
||||
assert_equals(event.newValue, 'newValue');
|
||||
assert_equals(event.url, window.location.href);
|
||||
assert_equals(event.storageArea, window.localStorage);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var event = new StorageEvent('storage', {
|
||||
key: 'key',
|
||||
oldValue: 'oldValue',
|
||||
newValue: 'newValue',
|
||||
url: window.location.href,
|
||||
storageArea: window.localStorage
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_url</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("url property test of local event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
var url = window.location.href;
|
||||
|
||||
var pos = url.lastIndexOf("/");
|
||||
if (pos != -1) {
|
||||
url = url.substr(0, pos + 1);
|
||||
url = url + "iframe/local_set_item_iframe.html";
|
||||
}
|
||||
|
||||
assert_equals(event.url, url);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("key property test of session event");
|
||||
var expected = ['name', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_clear_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_newValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("newvalue property test of session event");
|
||||
var expected = ['user1', 'user2', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.newValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_oldValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("oldvalue property test of session event");
|
||||
var expected = [null, 'user1', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.oldValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_storageArea</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageArea property test of session event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.storageArea.length, 1);
|
||||
var key = event.storageArea.key(0);
|
||||
var value = event.storageArea.getItem(key);
|
||||
assert_equals(key, "name");
|
||||
assert_equals(value, "user1");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_StorageEventInit</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, 'key');
|
||||
assert_equals(event.oldValue, 'oldValue');
|
||||
assert_equals(event.newValue, 'newValue');
|
||||
assert_equals(event.url, window.location.href);
|
||||
assert_equals(event.storageArea, window.sessionStorage);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var event = new StorageEvent('storage', {
|
||||
key: 'key',
|
||||
oldValue: 'oldValue',
|
||||
newValue: 'newValue',
|
||||
url: window.location.href,
|
||||
storageArea: window.sessionStorage
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_url</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("url property test of session event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
var url = window.location.href;
|
||||
|
||||
var pos = url.lastIndexOf("/");
|
||||
if (pos != -1) {
|
||||
url = url.substr(0, pos + 1);
|
||||
url = url + "iframe/session_set_item_iframe.html";
|
||||
}
|
||||
|
||||
assert_equals(event.url, url);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(localStorage.getItem("name"), null);
|
||||
assert_equals(localStorage.length, 1);
|
||||
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
test(function() {
|
||||
assert_equals(localStorage.getItem("name"), "user1", "localStorage.getItem('name')")
|
||||
assert_equals(localStorage.getItem("unknown"), null, "localStorage.getItem('unknown')")
|
||||
}, "getItem method test")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
localStorage.setItem("a", "1");
|
||||
localStorage.setItem("b", "2");
|
||||
|
||||
var keys = ["name", "age", "a", "b"];
|
||||
function doTest(index) {
|
||||
test(function() {
|
||||
var key = localStorage.key(index);
|
||||
assert_not_equals(key, null);
|
||||
assert_true(keys.indexOf(key) >= 0,
|
||||
"Unexpected key " + key + " found.");
|
||||
}, "key(" + index + ") should return the right thing.");
|
||||
}
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
doTest(i);
|
||||
doTest(i + 0x100000000);
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(localStorage.key(-1), null, "localStorage.key(-1)");
|
||||
assert_equals(localStorage.key(4), null, "localStorage.key(4)");
|
||||
}, "key() should return null for out-of-range arguments.");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
|
||||
localStorage.removeItem("name");
|
||||
localStorage.removeItem("unknown");
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_security</h1>
|
||||
<iframe id="frame" src="iframe/local_security_iframe.html" style="width: 0px; height: 0px;"></iframe>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t1 = async_test('storage local security test');
|
||||
|
||||
iframeWindow = document.getElementById('frame').contentWindow;
|
||||
|
||||
setTimeout(function(){
|
||||
try {
|
||||
var errFlag =iframeWindow.localStorage.getItem("Security");
|
||||
t1.step(function() {
|
||||
assert_equals(errFlag, "true", 'SECURITY_ERR error is not raised.')
|
||||
});
|
||||
} catch (e) {
|
||||
t1.step(function() {
|
||||
assert_unreached('Error is raised.');
|
||||
});
|
||||
}
|
||||
t1.done();
|
||||
}, 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.length, 1, "localStorage.setItem")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(sessionStorage.getItem("name"), null);
|
||||
assert_equals(sessionStorage.length, 1);
|
||||
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.getItem("name"), "user1", "sessionStorage.getItem('name')")
|
||||
assert_equals(sessionStorage.getItem("unknown"), null, "sessionStorage.getItem('unknown')")
|
||||
}, "getItem method test")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
sessionStorage.setItem("a", "1");
|
||||
sessionStorage.setItem("b", "2");
|
||||
|
||||
var keys = ["name", "age", "a", "b"];
|
||||
function doTest(index) {
|
||||
test(function() {
|
||||
var key = sessionStorage.key(index);
|
||||
assert_not_equals(key, null);
|
||||
assert_true(keys.indexOf(key) >= 0,
|
||||
"Unexpected key " + key + " found.");
|
||||
}, "key(" + index + ") should return the right thing.");
|
||||
}
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
doTest(i);
|
||||
doTest(i + 0x100000000);
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.key(-1), null, "sessionStorage.key(-1)");
|
||||
assert_equals(sessionStorage.key(4), null, "sessionStorage.key(4)");
|
||||
}, "key() should return null for out-of-range arguments.");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
|
||||
sessionStorage.removeItem("name");
|
||||
sessionStorage.removeItem("unknown");
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.length, 1, "localStorage.setItem")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
function test_storage_builtins(aStorage) {
|
||||
test(function() {
|
||||
aStorage.clear();
|
||||
assert_equals(aStorage.length, 0, "aStorage.length");
|
||||
|
||||
var builtins = ["key", "getItem", "setItem", "removeItem", "clear"];
|
||||
var origBuiltins = builtins.map(function(b) { return Storage.prototype[b]; });
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage[b]; }), origBuiltins, "a");
|
||||
builtins.forEach(function(b) { aStorage[b] = b; });
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage[b]; }), origBuiltins, "b");
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage.getItem(b); }), builtins, "c");
|
||||
|
||||
assert_equals(aStorage.length, builtins.length, "aStorage.length");
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_Constructor</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("StorageEvent constructor and nulls");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.type, 'storage', 'type');
|
||||
assert_equals(event.key, null, 'key');
|
||||
assert_equals(event.oldValue, null, 'oldValue');
|
||||
assert_equals(event.newValue, null, 'newValue');
|
||||
assert_equals(event.url, 'null', 'url');
|
||||
assert_equals(event.storageArea, null, 'storageArea');
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
var event = new StorageEvent('storage', {
|
||||
key: null,
|
||||
oldValue: null,
|
||||
newValue: null,
|
||||
url: null
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>missing_arguments</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = [
|
||||
function() { localStorage.key(); },
|
||||
function() { localStorage.getItem(); },
|
||||
function() { localStorage.setItem(); },
|
||||
function() { localStorage.setItem("a"); },
|
||||
function() { localStorage.removeItem(); },
|
||||
function() { sessionStorage.key(); },
|
||||
function() { sessionStorage.getItem(); },
|
||||
function() { sessionStorage.setItem(); },
|
||||
function() { sessionStorage.setItem("a"); },
|
||||
function() { sessionStorage.removeItem(); },
|
||||
function() { new StorageEvent(); }
|
||||
];
|
||||
tests.forEach(function(fun) {
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), fun);
|
||||
}, "Should throw TypeError for " + format_value(fun) + ".");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="storage_builtins.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_builtins</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test_storage_builtins(localStorage);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(localStorage.name, undefined);
|
||||
assert_equals(localStorage.length, 1);
|
||||
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.name, undefined, "localStorage.name")
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("undefined", "foo");
|
||||
localStorage.setItem("null", "bar");
|
||||
localStorage.setItem("", "baz");
|
||||
test(function() {
|
||||
assert_equals(localStorage.length, 3);
|
||||
}, "All 3 items should be added.");
|
||||
test(function() {
|
||||
assert_equals(localStorage["unknown"], undefined, "localStorage['unknown']")
|
||||
assert_equals(localStorage["undefined"], "foo", "localStorage['undefined']")
|
||||
assert_equals(localStorage["null"], "bar", "localStorage['null']")
|
||||
assert_equals(localStorage[undefined], "foo", "localStorage[undefined]")
|
||||
assert_equals(localStorage[null], "bar", "localStorage[null]")
|
||||
assert_equals(localStorage[""], "baz", "localStorage['']")
|
||||
}, "array access should be correct");
|
||||
test(function() {
|
||||
assert_equals(localStorage.getItem("undefined"), "foo", "localStorage.getItem('undefined')")
|
||||
assert_equals(localStorage.getItem("null"), "bar", "localStorage.getItem('null')")
|
||||
assert_equals(localStorage.getItem(undefined), "foo", "localStorage.getItem(undefined)")
|
||||
assert_equals(localStorage.getItem(null), "bar", "localStorage.getItem(null)")
|
||||
assert_equals(localStorage.getItem(""), "baz", "localStorage.getItem('')")
|
||||
}, "getItem should be correct")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_in</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_false("name" in localStorage);
|
||||
localStorage["name"] = "user1";
|
||||
assert_true("name" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_false("name" in localStorage);
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.name, "user1");
|
||||
localStorage.removeItem("name");
|
||||
assert_false("name" in localStorage);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_index</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage["name"] = "user1";
|
||||
localStorage["age"] = "42";
|
||||
test(function() {
|
||||
assert_equals(localStorage[-1], undefined);
|
||||
assert_equals(localStorage[0], undefined);
|
||||
assert_equals(localStorage[1], undefined);
|
||||
assert_equals(localStorage[2], undefined);
|
||||
})
|
||||
test(function() {
|
||||
assert_equals(localStorage["-1"], undefined);
|
||||
assert_equals(localStorage["0"], undefined);
|
||||
assert_equals(localStorage["1"], undefined);
|
||||
assert_equals(localStorage["2"], undefined);
|
||||
})
|
||||
localStorage.setItem(1, "number");
|
||||
test(function() {
|
||||
assert_equals(localStorage[1], "number");
|
||||
assert_equals(localStorage["1"], "number");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
|
||||
localStorage["name"] = "user1";
|
||||
localStorage["age"] = "20";
|
||||
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
|
||||
test(function() {
|
||||
delete localStorage["name"];
|
||||
delete localStorage["unknown"];
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("null", "test");
|
||||
assert_true("null" in localStorage);
|
||||
localStorage.removeItem(null, "test");
|
||||
assert_false("null" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("undefined", "test");
|
||||
assert_true("undefined" in localStorage);
|
||||
localStorage.removeItem(undefined, "test");
|
||||
assert_false("undefined" in localStorage);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test_error = { name: "test" };
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
test(function() {
|
||||
assert_false("name" in localStorage);
|
||||
assert_false("age" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage["name"] = "user1";
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
assert_equals(localStorage["name"], "user1");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["name"] = "user2";
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user2");
|
||||
assert_equals(localStorage["name"], "user2");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("name", "user3");
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user3");
|
||||
assert_equals(localStorage["name"], "user3");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("age", null);
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "null");
|
||||
assert_equals(localStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["age"] = null;
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "null");
|
||||
assert_equals(localStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("age", undefined);
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["age"] = undefined;
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
localStorage.setItem("age",
|
||||
{ toString: function() { throw test_error; } });
|
||||
});
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
localStorage["age"] =
|
||||
{ toString: function() { throw test_error; } };
|
||||
});
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem(undefined, "test");
|
||||
assert_true("undefined" in localStorage);
|
||||
assert_equals(localStorage.length, 3, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("undefined"), "test");
|
||||
assert_equals(localStorage["undefined"], "test");
|
||||
});
|
||||
test(function() {
|
||||
localStorage[undefined] = "test2";
|
||||
assert_true("undefined" in localStorage);
|
||||
assert_equals(localStorage.length, 3, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("undefined"), "test2");
|
||||
assert_equals(localStorage["undefined"], "test2");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem(null, "test");
|
||||
assert_true("null" in localStorage);
|
||||
assert_equals(localStorage.length, 4, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("null"), "test");
|
||||
assert_equals(localStorage["null"], "test");
|
||||
});
|
||||
test(function() {
|
||||
localStorage[null] = "test2";
|
||||
assert_true("null" in localStorage);
|
||||
assert_equals(localStorage.length, 4, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("null"), "test2");
|
||||
assert_equals(localStorage["null"], "test2");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="storage_builtins.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_builtins</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test_storage_builtins(sessionStorage);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(sessionStorage.name, undefined);
|
||||
assert_equals(sessionStorage.length, 1);
|
||||
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.name, undefined, "sessionStorage.name")
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("undefined", "foo");
|
||||
sessionStorage.setItem("null", "bar");
|
||||
sessionStorage.setItem("", "baz");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.length, 3);
|
||||
}, "All 3 items should be added.");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage["unknown"], undefined, "sessionStorage['unknown']")
|
||||
assert_equals(sessionStorage["undefined"], "foo", "sessionStorage['undefined']")
|
||||
assert_equals(sessionStorage["null"], "bar", "sessionStorage['null']")
|
||||
assert_equals(sessionStorage[undefined], "foo", "sessionStorage[undefined]")
|
||||
assert_equals(sessionStorage[null], "bar", "sessionStorage[null]")
|
||||
assert_equals(sessionStorage[""], "baz", "sessionStorage['']")
|
||||
}, "array access should be correct");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.getItem("undefined"), "foo", "sessionStorage.getItem('undefined')")
|
||||
assert_equals(sessionStorage.getItem("null"), "bar", "sessionStorage.getItem('null')")
|
||||
assert_equals(sessionStorage.getItem(undefined), "foo", "sessionStorage.getItem(undefined)")
|
||||
assert_equals(sessionStorage.getItem(null), "bar", "sessionStorage.getItem(null)")
|
||||
assert_equals(sessionStorage.getItem(""), "baz", "sessionStorage.getItem('')")
|
||||
}, "getItem should be correct")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_in</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_false("name" in sessionStorage);
|
||||
sessionStorage["name"] = "user1";
|
||||
assert_true("name" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_false("name" in sessionStorage);
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.name, "user1");
|
||||
sessionStorage.removeItem("name");
|
||||
assert_false("name" in sessionStorage);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_index</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage["name"] = "user1";
|
||||
sessionStorage["age"] = "42";
|
||||
test(function() {
|
||||
assert_equals(sessionStorage[-1], undefined);
|
||||
assert_equals(sessionStorage[0], undefined);
|
||||
assert_equals(sessionStorage[1], undefined);
|
||||
assert_equals(sessionStorage[2], undefined);
|
||||
})
|
||||
test(function() {
|
||||
assert_equals(sessionStorage["-1"], undefined);
|
||||
assert_equals(sessionStorage["0"], undefined);
|
||||
assert_equals(sessionStorage["1"], undefined);
|
||||
assert_equals(sessionStorage["2"], undefined);
|
||||
})
|
||||
sessionStorage.setItem(1, "number");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage[1], "number");
|
||||
assert_equals(sessionStorage["1"], "number");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
|
||||
sessionStorage["name"] = "user1";
|
||||
sessionStorage["age"] = "20";
|
||||
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
|
||||
test(function() {
|
||||
delete sessionStorage["name"];
|
||||
delete sessionStorage["unknown"];
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("null", "test");
|
||||
assert_true("null" in sessionStorage);
|
||||
sessionStorage.removeItem(null, "test");
|
||||
assert_false("null" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("undefined", "test");
|
||||
assert_true("undefined" in sessionStorage);
|
||||
sessionStorage.removeItem(undefined, "test");
|
||||
assert_false("undefined" in sessionStorage);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test_error = { name: "test" };
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
test(function() {
|
||||
assert_false("name" in sessionStorage);
|
||||
assert_false("age" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["name"] = "user1";
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
assert_equals(sessionStorage["name"], "user1");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["name"] = "user2";
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user2");
|
||||
assert_equals(sessionStorage["name"], "user2");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("name", "user3");
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user3");
|
||||
assert_equals(sessionStorage["name"], "user3");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("age", null);
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "null");
|
||||
assert_equals(sessionStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["age"] = null;
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "null");
|
||||
assert_equals(sessionStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("age", undefined);
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["age"] = undefined;
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
sessionStorage.setItem("age",
|
||||
{ toString: function() { throw test_error; } });
|
||||
});
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
sessionStorage["age"] =
|
||||
{ toString: function() { throw test_error; } };
|
||||
});
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem(undefined, "test");
|
||||
assert_true("undefined" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 3, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("undefined"), "test");
|
||||
assert_equals(sessionStorage["undefined"], "test");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage[undefined] = "test2";
|
||||
assert_true("undefined" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 3, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("undefined"), "test2");
|
||||
assert_equals(sessionStorage["undefined"], "test2");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem(null, "test");
|
||||
assert_true("null" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 4, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("null"), "test");
|
||||
assert_equals(sessionStorage["null"], "test");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage[null] = "test2";
|
||||
assert_true("null" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 4, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("null"), "test2");
|
||||
assert_equals(sessionStorage["null"], "test2");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>FormData.append</title>
|
||||
<link rel=help href=http://xhr.spec.whatwg.org/#dom-formdata-append>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var fd = new FormData();
|
||||
fd.append("name", new String("value"));
|
||||
// TODO: test that it actually worked.
|
||||
}, "Passing a String object to FormData.append should work.");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>XMLHttpRequest IDL tests</title>
|
||||
<div id=log></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script type=text/plain class=untested>
|
||||
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);
|
||||
};
|
||||
</script>
|
||||
<script type=text/plain>
|
||||
[NoInterfaceObject]
|
||||
interface XMLHttpRequestEventTarget : EventTarget {
|
||||
// event handlers
|
||||
[TreatNonCallableAsNull] attribute Function? onloadstart;
|
||||
[TreatNonCallableAsNull] attribute Function? onprogress;
|
||||
[TreatNonCallableAsNull] attribute Function? onabort;
|
||||
[TreatNonCallableAsNull] attribute Function? onerror;
|
||||
[TreatNonCallableAsNull] attribute Function? onload;
|
||||
[TreatNonCallableAsNull] attribute Function? ontimeout;
|
||||
[TreatNonCallableAsNull] attribute Function? onloadend;
|
||||
};
|
||||
|
||||
interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
enum XMLHttpRequestResponseType {
|
||||
"",
|
||||
"arraybuffer",
|
||||
"blob",
|
||||
"document",
|
||||
"json",
|
||||
"text"
|
||||
};
|
||||
*/
|
||||
|
||||
[Constructor]
|
||||
interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
// event handler
|
||||
[TreatNonCallableAsNull] attribute Function? onreadystatechange;
|
||||
|
||||
// states
|
||||
const unsigned short UNSENT = 0;
|
||||
const unsigned short OPENED = 1;
|
||||
const unsigned short HEADERS_RECEIVED = 2;
|
||||
const unsigned short LOADING = 3;
|
||||
const unsigned short DONE = 4;
|
||||
readonly attribute unsigned short readyState;
|
||||
|
||||
// request
|
||||
void open(DOMString method, DOMString url, optional boolean async/* = true*/, optional DOMString? user, optional DOMString? password);
|
||||
void setRequestHeader(DOMString header, DOMString value);
|
||||
attribute unsigned long timeout;
|
||||
attribute boolean withCredentials;
|
||||
readonly attribute XMLHttpRequestUpload upload;
|
||||
void send(optional (ArrayBufferView or Blob or Document or DOMString or FormData)? data/* = null*/);
|
||||
void abort();
|
||||
|
||||
// response
|
||||
readonly attribute unsigned short status;
|
||||
readonly attribute DOMString statusText;
|
||||
DOMString? getResponseHeader(DOMString header);
|
||||
DOMString getAllResponseHeaders();
|
||||
void overrideMimeType(DOMString mime);
|
||||
/* attribute XMLHttpRequestResponseType responseType; */
|
||||
readonly attribute any response;
|
||||
readonly attribute DOMString responseText;
|
||||
readonly attribute Document? responseXML;
|
||||
};
|
||||
|
||||
[Constructor,
|
||||
Constructor(HTMLFormElement form)]
|
||||
interface FormData {
|
||||
void append(DOMString name, Blob value, optional DOMString filename);
|
||||
void append(DOMString name, DOMString value);
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
"use strict";
|
||||
var form = document.createElement("form");
|
||||
var idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
idlArray.add_objects({
|
||||
XMLHttpRequest: ['new XMLHttpRequest()'],
|
||||
XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'],
|
||||
FormData: ['new FormData()', 'new FormData(form)']
|
||||
});
|
||||
idlArray.test();
|
||||
</script>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>XMLHttpRequest: setRequestHeader() with invalid arguments</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<!--
|
||||
CHAR = <any US-ASCII character (octets 0 - 127)>
|
||||
CTL = <any US-ASCII control character
|
||||
(octets 0 - 31) and DEL (127)>
|
||||
SP = <US-ASCII SP, space (32)>
|
||||
HT = <US-ASCII HT, horizontal-tab (9)>
|
||||
token = 1*<any CHAR except CTLs or separators>
|
||||
separators = "(" | ")" | "<" | ">" | "@"
|
||||
| "," | ";" | ":" | "\" | <">
|
||||
| "/" | "[" | "]" | "?" | "="
|
||||
| "{" | "}" | SP | HT
|
||||
field-name = token
|
||||
-->
|
||||
<script>
|
||||
var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
|
||||
"\"", "/", "[", "]", "?", "=", "{", "}", " ",
|
||||
"\u0009", "\u007f"]
|
||||
for (var i = 0; i < 32; ++i) {
|
||||
invalid_headers.push(String.fromCharCode(i))
|
||||
}
|
||||
for (var i = 0; i < invalid_headers.length; ++i) {
|
||||
test(function() {
|
||||
assert_throws("SYNTAX_ERR", function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "../resources/delay.php?ms=0")
|
||||
client.setRequestHeader(invalid_headers[i], "test")
|
||||
}, "setRequestHeader should throw with header " +
|
||||
format_value(invalid_headers[i]) +".")
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
60
dom/imptests/webapps/mochitest.ini
Normal file
60
dom/imptests/webapps/mochitest.ini
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
WebStorage/tests/submissions/Infraware/iframe/local_change_item_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/local_security_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/local_set_item_clear_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/local_set_item_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/session_change_item_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/session_set_item_clear_iframe.html
|
||||
WebStorage/tests/submissions/Infraware/iframe/session_set_item_iframe.html
|
||||
WebStorage/tests/submissions/Ms2ger/storage_builtins.js
|
||||
|
||||
[WebStorage/tests/submissions/Infraware/test_event_constructor.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_key.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_newvalue.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_oldvalue.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_storagearea.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_storageeventinit.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_local_url.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_key.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_newvalue.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_oldvalue.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_storagearea.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_storageeventinit.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_event_session_url.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_clear.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_getitem.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_key.html]
|
||||
skip-if = toolkit == 'android' #bug 775227
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_length.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_removeitem.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_security.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_local_setitem.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_clear.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_getitem.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_key.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_length.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_removeitem.html]
|
||||
[WebStorage/tests/submissions/Infraware/test_storage_session_setitem.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_event_constructor_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_missing_arguments.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_builtins.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_clear_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_getitem_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_in_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_index_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_length_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_removeitem_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_local_setitem_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_builtins.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_clear_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_getitem_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_in_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_index_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_length_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_removeitem_js.html]
|
||||
[WebStorage/tests/submissions/Ms2ger/test_storage_session_setitem_js.html]
|
||||
[XMLHttpRequest/tests/submissions/Ms2ger/test_FormData-append.html]
|
||||
[XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html]
|
||||
[XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm]
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue