2015-01-23 06:54:15 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Test for Bug 1107443</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 1107443 **/
|
|
|
|
try {
|
2015-07-23 08:51:09 -07:00
|
|
|
Object.defineProperty(window, "nosuchprop", { value: 5, configurable: false });
|
2015-01-23 06:54:15 -08:00
|
|
|
throw "didn't throw";
|
|
|
|
} catch (e) {
|
2015-05-12 16:52:01 -07:00
|
|
|
is(e instanceof TypeError, true,
|
|
|
|
"defineProperty(window) with a non-configurable property should " +
|
|
|
|
"throw a TypeError, instead got: " + e);
|
|
|
|
is(Object.getOwnPropertyDescriptor(window, "nosuchprop"), undefined,
|
|
|
|
'Window should not have property after an attempt to define it failed');
|
2015-01-23 06:54:15 -08:00
|
|
|
}
|
|
|
|
|
2015-07-23 08:51:09 -07:00
|
|
|
Object.defineProperty(window, "nosuchprop", { value: 6 });
|
2015-01-23 06:54:15 -08:00
|
|
|
var desc = Object.getOwnPropertyDescriptor(window, "nosuchprop");
|
2015-05-12 16:52:01 -07:00
|
|
|
is(typeof(desc), "object", "Should have a property now");
|
2015-07-23 08:51:09 -07:00
|
|
|
todo_is(desc.configurable, true, "Property should be configurable");
|
|
|
|
is(desc.writable, false, "Property should be readonly");
|
|
|
|
is(desc.value, 6, "Property should have the right value");
|
|
|
|
|
|
|
|
Object.defineProperty(window, "nosuchprop2", { value: 7, configurable: true });
|
|
|
|
desc = Object.getOwnPropertyDescriptor(window, "nosuchprop2");
|
|
|
|
is(typeof(desc), "object", "Should have a property now");
|
2015-05-12 16:52:01 -07:00
|
|
|
is(desc.configurable, true, "Property should be configurable");
|
|
|
|
is(desc.writable, false, "Property should be readonly");
|
|
|
|
is(desc.value, 7, "Property should have the right value");
|
2015-01-23 06:54:15 -08:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107443">Mozilla Bug 1107443</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|