mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987549 - Wait until BrowserElement child scripts have been loaded before dispatching inputMethod setActive request. r=yxl
This commit is contained in:
parent
091b0c9469
commit
fc5a26259f
@ -15,12 +15,6 @@ function debug(msg) {
|
||||
// mozbrowser API clients.
|
||||
docShell.isActive = true;
|
||||
|
||||
let infos = sendSyncMessage('browser-element-api:call',
|
||||
{ 'msg_name': 'hello' })[0];
|
||||
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
|
||||
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
|
||||
|
||||
|
||||
function parentDocShell(docshell) {
|
||||
if (!docshell) {
|
||||
return null;
|
||||
@ -57,3 +51,8 @@ if (!('BrowserElementIsPreloaded' in this)) {
|
||||
}
|
||||
|
||||
var BrowserElementIsReady = true;
|
||||
|
||||
let infos = sendSyncMessage('browser-element-api:call',
|
||||
{ 'msg_name': 'hello' })[0];
|
||||
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
|
||||
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
|
||||
|
@ -366,9 +366,11 @@ BrowserElementParent.prototype = {
|
||||
return true;
|
||||
},
|
||||
|
||||
_recvHello: function(data) {
|
||||
_recvHello: function() {
|
||||
debug("recvHello");
|
||||
|
||||
this._ready = true;
|
||||
|
||||
// Inform our child if our owner element's document is invisible. Note
|
||||
// that we must do so here, rather than in the BrowserElementParent
|
||||
// constructor, because the BrowserElementChild may not be initialized when
|
||||
@ -382,7 +384,7 @@ BrowserElementParent.prototype = {
|
||||
fullscreenAllowed:
|
||||
this._frameElement.hasAttribute('allowfullscreen') ||
|
||||
this._frameElement.hasAttribute('mozallowfullscreen')
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
_fireCtxMenuEvent: function(data) {
|
||||
@ -724,15 +726,31 @@ BrowserElementParent.prototype = {
|
||||
} else {
|
||||
let reqOld = XPCNativeWrapper.unwrap(activeInputFrame)
|
||||
.setInputMethodActive(false);
|
||||
reqOld.onsuccess = function() {
|
||||
activeInputFrame = null;
|
||||
this._sendSetInputMethodActiveDOMRequest(req, isActive);
|
||||
|
||||
// We wan't to continue regardless whether this req succeeded
|
||||
reqOld.onsuccess = reqOld.onerror = function() {
|
||||
let setActive = function() {
|
||||
activeInputFrame = null;
|
||||
this._sendSetInputMethodActiveDOMRequest(req, isActive);
|
||||
}.bind(this);
|
||||
|
||||
if (this._ready) {
|
||||
setActive();
|
||||
return;
|
||||
}
|
||||
|
||||
// Wait for the hello event from BrowserElementChild
|
||||
let onReady = function(aMsg) {
|
||||
if (this._isAlive() && (aMsg.data.msg_name === 'hello')) {
|
||||
setActive();
|
||||
|
||||
this._mm.removeMessageListener('browser-element-api:call',
|
||||
onReady);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this._mm.addMessageListener('browser-element-api:call', onReady);
|
||||
}.bind(this);
|
||||
reqOld.onerror = function() {
|
||||
Services.DOMRequest.fireErrorAsync(req,
|
||||
'Failed to deactivate the old input method: ' +
|
||||
reqOld.error + '.');
|
||||
};
|
||||
}
|
||||
} else {
|
||||
this._sendSetInputMethodActiveDOMRequest(req, isActive);
|
||||
|
Loading…
Reference in New Issue
Block a user