mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 801703 - enable switching to nested OOP frame, r=jgriffin, a=NPOTB
This commit is contained in:
parent
267b46d7a3
commit
018ee9c000
@ -1610,7 +1610,7 @@ MarionetteDriverActor.prototype = {
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.getOuterWindowWithId(message.json.win);
|
||||
let thisFrame = frameWindow.document.getElementsByTagName("iframe")[message.json.frame];
|
||||
let mm = thisFrame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager
|
||||
let mm = thisFrame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
|
||||
|
||||
// See if this frame already has our frame script loaded in it; if so,
|
||||
// just wake it up.
|
||||
|
@ -787,6 +787,11 @@ function clearElement(msg) {
|
||||
*/
|
||||
function switchToFrame(msg) {
|
||||
let foundFrame = null;
|
||||
let frames = curWindow.document.getElementsByTagName("iframe");
|
||||
//Until Bug 761935 lands, we won't have multiple nested OOP iframes. We will only have one.
|
||||
//parWindow will refer to the iframe above the nested OOP frame.
|
||||
let parWindow = curWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
if ((msg.json.value == null) && (msg.json.element == null)) {
|
||||
curWindow = content;
|
||||
curWindow.focus();
|
||||
@ -796,44 +801,42 @@ 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 frames = curWindow.document.getElementsByTagName("iframe");
|
||||
for (let i = 0; i < frames.length; i++) {
|
||||
if (frames[i] == wantedFrame) {
|
||||
curWindow = frames[i];
|
||||
curWindow.focus();
|
||||
sendOk();
|
||||
return;
|
||||
foundFrame = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let frames = curWindow.document.getElementsByTagName("iframe");
|
||||
switch(typeof(msg.json.value)) {
|
||||
case "string" :
|
||||
let foundById = null;
|
||||
for (let i = 0; i < frames.length; i++) {
|
||||
//give precedence to name
|
||||
let frame = frames[i];
|
||||
let name = utils.getElementAttribute(frame, 'name');
|
||||
let id = utils.getElementAttribute(frame, 'id');
|
||||
if (name == msg.json.value) {
|
||||
foundFrame = i;
|
||||
break;
|
||||
} else if ((foundById == null) && (id == msg.json.value)) {
|
||||
foundById = i;
|
||||
if (foundFrame == null) {
|
||||
switch(typeof(msg.json.value)) {
|
||||
case "string" :
|
||||
let foundById = null;
|
||||
for (let i = 0; i < frames.length; i++) {
|
||||
//give precedence to name
|
||||
let frame = frames[i];
|
||||
let name = utils.getElementAttribute(frame, 'name');
|
||||
let id = utils.getElementAttribute(frame, 'id');
|
||||
if (name == msg.json.value) {
|
||||
foundFrame = i;
|
||||
break;
|
||||
} else if ((foundById == null) && (id == msg.json.value)) {
|
||||
foundById = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((foundFrame == null) && (foundById != null)) {
|
||||
foundFrame = foundById;
|
||||
curWindow = frames[foundFrame];
|
||||
}
|
||||
break;
|
||||
case "number":
|
||||
if (frames[msg.json.value] != undefined) {
|
||||
foundFrame = msg.json.value;
|
||||
curWindow = frames[foundFrame];
|
||||
}
|
||||
break;
|
||||
if ((foundFrame == null) && (foundById != null)) {
|
||||
foundFrame = foundById;
|
||||
curWindow = frames[foundFrame];
|
||||
}
|
||||
break;
|
||||
case "number":
|
||||
if (frames[msg.json.value] != undefined) {
|
||||
foundFrame = msg.json.value;
|
||||
curWindow = frames[foundFrame];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundFrame == null) {
|
||||
sendError("Unable to locate frame: " + msg.json.value, 8, null);
|
||||
@ -846,7 +849,7 @@ function switchToFrame(msg) {
|
||||
// The frame we want to switch to is a remote frame; notify our parent to handle
|
||||
// the switch.
|
||||
curWindow = content;
|
||||
sendToServer('Marionette:switchToFrame', {win: winUtil.outerWindowID, frame: foundFrame});
|
||||
sendToServer('Marionette:switchToFrame', {frame: foundFrame, win: parWindow});
|
||||
}
|
||||
else {
|
||||
curWindow = curWindow.contentWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user