Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: LayoutTests/fast/js/script-tests/global-constructors-attributes.js

Issue 14447006: Global constructors should be configurable and not enumerable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clean rebase on master Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/js/script-tests/global-constructors.js ('k') | Source/bindings/scripts/CodeGeneratorV8.pm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/js/script-tests/global-constructors-attributes.js
diff --git a/LayoutTests/fast/js/script-tests/global-constructors-attributes.js b/LayoutTests/fast/js/script-tests/global-constructors-attributes.js
new file mode 100644
index 0000000000000000000000000000000000000000..7717c658ca1804f445179f416848a83cafd91d7a
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/global-constructors-attributes.js
@@ -0,0 +1,27 @@
+description("Test to ensure that global constructors have the right attributes");
+
+function descriptorShouldBe(object, property, expected) {
+ var test = "Object.getOwnPropertyDescriptor(" + object + ", " + property + ")";
+ if ("writable" in expected) {
+ shouldBe(test + ".value", "" + expected.value);
+ shouldBeFalse(test + ".hasOwnProperty('get')");
+ shouldBeFalse(test + ".hasOwnProperty('set')");
+ } else {
+ shouldBe(test + ".get", "" + expected.get);
+ shouldBe(test + ".set", "" + expected.set);
+ shouldBeFalse(test + ".hasOwnProperty('value')");
+ shouldBeFalse(test + ".hasOwnProperty('writable')");
+ }
+ shouldBe(test + ".enumerable", "" + expected.enumerable);
+ shouldBe(test + ".configurable", "" + expected.configurable);
+}
+
+var global = this;
+
+descriptorShouldBe("global", "'CSSRuleList'", {writable: true, enumerable: false, configurable: true, value:"CSSRuleList"});
+descriptorShouldBe("global", "'Document'", {writable: true, enumerable: false, configurable: true, value:"Document"});
+descriptorShouldBe("global", "'Element'", {writable: true, enumerable: false, configurable: true, value:"Element"});
+descriptorShouldBe("global", "'HTMLDivElement'", {writable: true, enumerable: false, configurable: true, value:"HTMLDivElement"});
+descriptorShouldBe("global", "'ProgressEvent'", {writable: true, enumerable: false, configurable: true, value:"ProgressEvent"});
+descriptorShouldBe("global", "'Selection'", {writable: true, enumerable: false, configurable: true, value:"Selection"});
+descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"});
« no previous file with comments | « LayoutTests/fast/js/script-tests/global-constructors.js ('k') | Source/bindings/scripts/CodeGeneratorV8.pm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698