From cbdb17ecc501a7ce62499792761f713472a5b14d Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Mon, 4 Feb 2013 11:40:51 -0800 Subject: [PATCH] Bug 834266 - Use XPCNativeWrapper to compare elements, r=mdas --- testing/marionette/marionette-elements.js | 4 ++-- testing/marionette/marionette-listener.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/testing/marionette/marionette-elements.js b/testing/marionette/marionette-elements.js index f6bfb339b9ea..e9942959e658 100644 --- a/testing/marionette/marionette-elements.js +++ b/testing/marionette/marionette-elements.js @@ -97,8 +97,8 @@ ElementManager.prototype = { if (!el) { throw new ElementException("Element has not been seen before", 17, null); } - el = el; - if (!(el.ownerDocument.isEqualNode(win.document))) { + // use XPCNativeWrapper to compare elements; see bug 834266 + if (!(XPCNativeWrapper(el).ownerDocument == XPCNativeWrapper(win).document)) { throw new ElementException("Stale element reference", 10, null); } return el; diff --git a/testing/marionette/marionette-listener.js b/testing/marionette/marionette-listener.js index 780b8b099092..1a0e8526e634 100644 --- a/testing/marionette/marionette-listener.js +++ b/testing/marionette/marionette-listener.js @@ -1162,9 +1162,16 @@ function switchToFrame(msg) { } if (msg.json.element != undefined) { if (elementManager.seenItems[msg.json.element] != undefined) { - let wantedFrame = elementManager.getKnownElement(msg.json.element, curWindow); //HTMLIFrameElement + let wantedFrame; + try { + wantedFrame = elementManager.getKnownElement(msg.json.element, curWindow); //HTMLIFrameElement + } + catch(e) { + sendError(e.message, e.code, e.stack, command_id); + } for (let i = 0; i < frames.length; i++) { - if (frames[i].isEqualNode(wantedFrame)) { + // use XPCNativeWrapper to compare elements; see bug 834266 + if (XPCNativeWrapper(frames[i]) == XPCNativeWrapper(wantedFrame)) { curWindow = frames[i]; foundFrame = i; }