зеркало из https://github.com/mozilla/gecko-dev.git
Bug 935784 - Avoid popping up the findbar when editing text fields in e10s (r=evilpie)
This commit is contained in:
Родитель
c4942592ad
Коммит
6d6a7fb256
|
@ -10,6 +10,22 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
Cu.import("resource://gre/modules/RemoteAddonsChild.jsm");
|
Cu.import("resource://gre/modules/RemoteAddonsChild.jsm");
|
||||||
|
|
||||||
|
let SyncHandler = {
|
||||||
|
init: function() {
|
||||||
|
sendAsyncMessage("SetSyncHandler", {}, {handler: this});
|
||||||
|
},
|
||||||
|
|
||||||
|
getFocusedElementAndWindow: function() {
|
||||||
|
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||||
|
|
||||||
|
let focusedWindow = {};
|
||||||
|
let elt = fm.getFocusedElementForWindow(content, true, focusedWindow);
|
||||||
|
return [elt, focusedWindow.value];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
SyncHandler.init();
|
||||||
|
|
||||||
let WebProgressListener = {
|
let WebProgressListener = {
|
||||||
init: function() {
|
init: function() {
|
||||||
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
@ -33,10 +49,8 @@ let WebProgressListener = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupObjects: function setupObjects(aWebProgress) {
|
_setupObjects: function setupObjects(aWebProgress) {
|
||||||
let win = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIDOMWindow);
|
|
||||||
return {
|
return {
|
||||||
contentWindow: win,
|
contentWindow: content,
|
||||||
// DOMWindow is not necessarily the content-window with subframes.
|
// DOMWindow is not necessarily the content-window with subframes.
|
||||||
DOMWindow: aWebProgress.DOMWindow
|
DOMWindow: aWebProgress.DOMWindow
|
||||||
};
|
};
|
||||||
|
|
|
@ -679,11 +679,15 @@
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let elt = document.commandDispatcher.focusedElement;
|
let elt = document.commandDispatcher.focusedElement;
|
||||||
|
let win = document.commandDispatcher.focusedWindow;
|
||||||
|
|
||||||
// Temporary fix for e10s.
|
// Temporary fix for e10s.
|
||||||
if (elt instanceof XULElement && elt.tagName == "xul:browser" &&
|
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
|
if (elt instanceof XULElement &&
|
||||||
|
elt.localName == "browser" &&
|
||||||
|
elt.namespaceURI == XUL_NS &&
|
||||||
elt.getAttribute("remote")) {
|
elt.getAttribute("remote")) {
|
||||||
elt = elt.contentDocument.activeElement;
|
[elt, win] = elt.syncHandler.getFocusedElementAndWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elt) {
|
if (elt) {
|
||||||
|
@ -697,7 +701,6 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let win = document.commandDispatcher.focusedWindow;
|
|
||||||
if (win && !this._mimeTypeIsTextBased(win.document.contentType))
|
if (win && !this._mimeTypeIsTextBased(win.document.contentType))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,12 @@
|
||||||
onget="return this.contentWindow ? this.contentWindow.document : null"
|
onget="return this.contentWindow ? this.contentWindow.document : null"
|
||||||
readonly="true"/>
|
readonly="true"/>
|
||||||
|
|
||||||
|
<field name="_syncHandler">null</field>
|
||||||
|
|
||||||
|
<property name="syncHandler"
|
||||||
|
onget="return this._syncHandler"
|
||||||
|
readonly="true"/>
|
||||||
|
|
||||||
<field name="_imageDocument">null</field>
|
<field name="_imageDocument">null</field>
|
||||||
|
|
||||||
<property name="imageDocument"
|
<property name="imageDocument"
|
||||||
|
@ -121,6 +127,7 @@
|
||||||
|
|
||||||
this.messageManager.addMessageListener("DOMTitleChanged", this);
|
this.messageManager.addMessageListener("DOMTitleChanged", this);
|
||||||
this.messageManager.addMessageListener("ImageDocumentLoaded", this);
|
this.messageManager.addMessageListener("ImageDocumentLoaded", this);
|
||||||
|
this.messageManager.addMessageListener("SetSyncHandler", this);
|
||||||
this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true);
|
this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true);
|
||||||
|
|
||||||
if (this.hasAttribute("selectpopup")) {
|
if (this.hasAttribute("selectpopup")) {
|
||||||
|
@ -159,6 +166,10 @@
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "SetSyncHandler":
|
||||||
|
this._syncHandler = aMessage.objects.handler;
|
||||||
|
break;
|
||||||
|
|
||||||
case "Forms:ShowDropDown": {
|
case "Forms:ShowDropDown": {
|
||||||
Cu.import("resource://gre/modules/SelectParentHelper.jsm");
|
Cu.import("resource://gre/modules/SelectParentHelper.jsm");
|
||||||
let dropdown = document.getElementById(this.getAttribute("selectpopup"));
|
let dropdown = document.getElementById(this.getAttribute("selectpopup"));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче