aboutsummaryrefslogtreecommitdiff
path: root/www/waterfox/files/patch-bug1412741
blob: 5bf24d87ce6188fc07cce81cfba0c661e6e4d67b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
commit 9bfa45f5e083
Author: Boris Zbarsky <bzbarsky@mit.edu>
Date:   Thu Nov 2 13:02:55 2017 -0400

    Bug 1412741 - Back out the fix for bug 1381408, because that change doesn't look like it's web-compatible. r=peterv, a=ritu
    
    MozReview-Commit-ID: LSYYAt0bAkT
    
    --HG--
    extra : source : 1fdce3a0396c599ad52749e1650beeb8f455d891
---
 js/xpconnect/tests/mochitest/test_bug862380.html   | 23 +++++-----------------
 js/xpconnect/wrappers/FilteringWrapper.cpp         |  5 +++--
 .../cross-origin-objects.html.ini                  | 10 ++++++++++
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git js/xpconnect/tests/mochitest/test_bug862380.html js/xpconnect/tests/mochitest/test_bug862380.html
index 0f1611776320..0d3fb7329358 100644
--- js/xpconnect/tests/mochitest/test_bug862380.html
+++ js/xpconnect/tests/mochitest/test_bug862380.html
@@ -13,29 +13,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=862380
   /** Test for Bug 862380 **/
   SimpleTest.waitForExplicitFinish();
   function go() {
-    checkNotEnumerable($('ifr').contentWindow, true);
-    checkNotEnumerable($('ifr').contentWindow.location, false);
+    checkNotEnumerable($('ifr').contentWindow);
+    checkNotEnumerable($('ifr').contentWindow.location);
     SimpleTest.finish();
   }
 
-function checkNotEnumerable(obj, isWindow) {
+  function checkNotEnumerable(obj) {
     try {
-      const expectedWindow = ["0", "window", "location", "top", "close",
-                              "focus", "blur", "postMessage", "self", "closed",
-                              "frames", "length", "opener", "parent"];
-      const expectedLocation = ["replace", "href"];
-      const expected = isWindow ? expectedWindow : expectedLocation;
-      is(Object.keys(obj).length, expected.length,
-         "Object.keys gives right array length");
-      var actual = [];
+      is(Object.keys(obj).length, 0, "Object.keys gives empty array");
       for (var i in obj)
-        actual.push(i);
-      is(actual.length, expected.length,
-         "Enumeration sees the right number of props");
-      actual.sort();
-      expected.sort();
-      for (var i = 0; i < actual.length; ++i)
-        is(actual[i], expected[i], "Arrays should be the same " + i);
+        ok(false, "Enumerated something: " + i);
     } catch (e) {
       ok(false, "threw: " + e);
     }
diff --git js/xpconnect/wrappers/FilteringWrapper.cpp js/xpconnect/wrappers/FilteringWrapper.cpp
index c35c3e896afc..1e986c734cde 100644
--- js/xpconnect/wrappers/FilteringWrapper.cpp
+++ js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -223,8 +223,9 @@ CrossOriginXrayWrapper::getPropertyDescriptor(JSContext* cx,
         // All properties on cross-origin DOM objects are |own|.
         desc.object().set(wrapper);
 
-        // All properties on cross-origin DOM objects are "configurable". Any
-        // value attributes are read-only.
+        // All properties on cross-origin DOM objects are non-enumerable and
+        // "configurable". Any value attributes are read-only.
+        desc.attributesRef() &= ~JSPROP_ENUMERATE;
         desc.attributesRef() &= ~JSPROP_PERMANENT;
         if (!desc.getter() && !desc.setter())
             desc.attributesRef() |= JSPROP_READONLY;
diff --git testing/web-platform/meta/html/browsers/origin/cross-origin-objects/cross-origin-objects.html.ini testing/web-platform/meta/html/browsers/origin/cross-origin-objects/cross-origin-objects.html.ini
new file mode 100644
index 000000000000..6c5e683863e9
--- /dev/null
+++ testing/web-platform/meta/html/browsers/origin/cross-origin-objects/cross-origin-objects.html.ini
@@ -0,0 +1,10 @@
+[cross-origin-objects.html]
+  type: testharness
+  [[[GetOwnProperty\]\] - Property descriptors for cross-origin properties should be set up correctly]
+    expected: FAIL
+
+  [Can only enumerate safelisted properties]
+    expected: FAIL
+
+  [[[OwnPropertyKeys\]\] should return all properties from cross-origin objects]
+    expected: FAIL