Skip to content

Commit 8a9e718

Browse files
committed
Merge pull request #96 from caisui/fix/issue_81
fix: __iterator__ set on Xray's XPathResult object not being called (3rd...
2 parents 4cbc329 + 1ae4fd2 commit 8a9e718

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

common/content/util.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,15 @@ const Util = Module("util", {
408408

409409
if (services.get("vc").compare(Application.version, "33") >= 0
410410
&& Cu.isXrayWrapper(result)) {
411-
let (xr = result, s = asIterator ? "iterateNext" : "snapshotItem") {
412-
result = Object.create(xr);
413-
result[s] = xr[s].bind(xr);
411+
let xr = result;
412+
413+
if (asIterator) {
414+
result = { iterateNext: function iterateNext() xr.iterateNext()};
415+
} else {
416+
result = {
417+
snapshotItem: function snapshotItem(num) xr.snapshotItem(num),
418+
get snapshotLength() xr.snapshotLength,
419+
};
414420
}
415421
}
416422

0 commit comments

Comments
 (0)