Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 425d289

Browse files
annevkjgraham
authored andcommitted
Remove usage of ancestorOrigins
WebKit throws the same exception as other browsers these days and ancestorOrigins might become less reliable due to whatwg/html#1918.
1 parent 380a49c commit 425d289

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

testharness.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,33 +157,14 @@ policies and contribution forms [3].
157157
var w = self;
158158
var i = 0;
159159
var so;
160-
var origins = location.ancestorOrigins;
161160
while (w != w.parent) {
162161
w = w.parent;
163-
// In WebKit, calls to parent windows' properties that aren't on the same
164-
// origin cause an error message to be displayed in the error console but
165-
// don't throw an exception. This is a deviation from the current HTML5
166-
// spec. See: https://bugs.webkit.org/show_bug.cgi?id=43504
167-
// The problem with WebKit's behavior is that it pollutes the error console
168-
// with error messages that can't be caught.
169-
//
170-
// This issue can be mitigated by relying on the (for now) proprietary
171-
// `location.ancestorOrigins` property which returns an ordered list of
172-
// the origins of enclosing windows. See:
173-
// http://trac.webkit.org/changeset/113945.
174-
if (origins) {
175-
so = (location.origin == origins[i]);
176-
} else {
177-
so = is_same_origin(w);
178-
}
162+
so = is_same_origin(w);
179163
cache.push([w, so]);
180164
i++;
181165
}
182166
w = window.opener;
183167
if (w) {
184-
// window.opener isn't included in the `location.ancestorOrigins` prop.
185-
// We'll just have to deal with a simple check and an error msg on WebKit
186-
// browsers in this case.
187168
cache.push([w, is_same_origin(w)]);
188169
}
189170
this.window_cache = cache;
@@ -1594,7 +1575,7 @@ policies and contribution forms [3].
15941575
* as another window or a worker. These events are then used to construct
15951576
* and maintain RemoteTest objects that mirror the tests running in the
15961577
* remote context.
1597-
*
1578+
*
15981579
* An optional third parameter can be used as a predicate to filter incoming
15991580
* MessageEvents.
16001581
*/

0 commit comments

Comments
 (0)