mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-08 00:07:30 +09:00
parent
31b26a24e3
commit
cedff6e214
28 changed files with 82 additions and 879 deletions
|
|
@ -569,7 +569,6 @@ support-files = file_cookiemanager.js
|
|||
support-files = file_bug871161-1.html file_bug871161-2.html
|
||||
[test_bug1013316.html]
|
||||
[test_hash_encoded.html]
|
||||
[test_bug1081037.html]
|
||||
[test_window_open_close.html]
|
||||
tags = openwindow
|
||||
[test_viewport_resize.html]
|
||||
|
|
|
|||
|
|
@ -1,133 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1081037
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1081037</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1081037 **/
|
||||
|
||||
function shouldThrow(fun, msg, ex, todo) {
|
||||
try {
|
||||
fun();
|
||||
ok(todo, msg);
|
||||
} catch (e) {
|
||||
ok(new RegExp(ex).test(e), msg + " (thrown:" + e + ")")
|
||||
}
|
||||
}
|
||||
|
||||
var Foo = document.registerElement('x-foo', {
|
||||
prototype: {bar: 5}
|
||||
});
|
||||
|
||||
Foo.prototype.bar = 6;
|
||||
var foo = new Foo();
|
||||
is(foo.bar, 6, "prototype of the ctor returned from registerElement works");
|
||||
|
||||
var protoDesc = Object.getOwnPropertyDescriptor(Foo, "prototype");
|
||||
is(protoDesc.configurable, false, "proto should be non-configurable");
|
||||
is(protoDesc.enumerable, false, "proto should be non-enumerable");
|
||||
is(protoDesc.writable, false, "proto should be non-writable");
|
||||
|
||||
// TODO: FIXME!
|
||||
shouldThrow(function() {
|
||||
document.registerElement('x-foo2', {
|
||||
prototype: Foo.prototype
|
||||
});
|
||||
},
|
||||
"if proto is an interface prototype object, registerElement should throw",
|
||||
"not supported",
|
||||
/* todo = */ true);
|
||||
|
||||
var nonConfigReadonlyProto = Object.create(HTMLElement.prototype,
|
||||
{ constructor: { configurable: false, writable: false, value: 42 } });
|
||||
|
||||
shouldThrow(function() {
|
||||
document.registerElement('x-nonconfig-readonly', {
|
||||
prototype: nonConfigReadonlyProto
|
||||
});
|
||||
},
|
||||
"non-configurable and not-writable constructor property",
|
||||
"not supported");
|
||||
|
||||
|
||||
// this is not defined in current spec:
|
||||
var readonlyProto = Object.create(HTMLElement.prototype,
|
||||
{ constructor: { configurable: true, writable: false, value: 42 } });
|
||||
|
||||
var Readonly = document.registerElement('x-nonconfig-readonly', {
|
||||
prototype: readonlyProto
|
||||
});
|
||||
|
||||
is(Readonly.prototype, readonlyProto, "configurable readonly constructor property");
|
||||
|
||||
var handler = {
|
||||
getOwnPropertyDescriptor: function(target, name) {
|
||||
return name == "constructor" ? undefined : Object.getOwnPropertyDescriptor(target,name);
|
||||
},
|
||||
defineProperty: function(target, name, propertyDescriptor) {
|
||||
if (name == "constructor") {
|
||||
throw "spec this";
|
||||
}
|
||||
|
||||
return Object.defineProperty(target, name, propertyDescriptor);
|
||||
},
|
||||
has: function(target, name) {
|
||||
if (name == "constructor") {
|
||||
return false;
|
||||
}
|
||||
return name in target;
|
||||
}
|
||||
};
|
||||
var proxy = new Proxy({}, handler);
|
||||
|
||||
shouldThrow(function() {
|
||||
document.registerElement('x-proxymagic', {
|
||||
prototype: proxy
|
||||
});
|
||||
},
|
||||
"proxy magic",
|
||||
"spec this");
|
||||
|
||||
var getOwn = 0;
|
||||
var defineProp = 0;
|
||||
var handler2 = {
|
||||
getOwnPropertyDescriptor: function(target, name) {
|
||||
if (name == "constructor") {
|
||||
getOwn++;
|
||||
}
|
||||
return Object.getOwnPropertyDescriptor(target,name);
|
||||
},
|
||||
defineProperty: function(target, name, propertyDescriptor) {
|
||||
if (name == "constructor") {
|
||||
defineProp++;
|
||||
}
|
||||
return Object.defineProperty(target, name, propertyDescriptor);
|
||||
}
|
||||
};
|
||||
var proxy2 = new Proxy({}, handler2);
|
||||
|
||||
document.registerElement('x-proxymagic2', {
|
||||
prototype: proxy2
|
||||
});
|
||||
|
||||
is(getOwn, 1, "number of getOwnPropertyDescriptor calls from registerElement: " + getOwn);
|
||||
is(defineProp, 1, "number of defineProperty calls from registerElement: " + defineProp);
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1081037">Mozilla Bug 1081037</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue