Bug 1147329 - Handle in-process case for Cut/Copy/Paste feature. r=kanru

--HG--
extra : commitid : H2bSIbLfEXs
This commit is contained in:
Jeremy Chen 2015-07-27 11:56:04 +08:00
parent 4b4ac7d1cb
commit 76c380be23
2 changed files with 17 additions and 0 deletions

View File

@ -41,7 +41,15 @@ if (!('BrowserElementIsPreloaded' in this)) {
} catch (e) {
}
}
}
if(Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
// general content apps
if (isTopBrowserElement(docShell)) {
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
}
} else {
// rocketbar in system app and other in-process case (ex. B2G desktop client)
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
}

View File

@ -8,6 +8,8 @@
dump("###################################### BrowserElementCopyPaste.js loaded\n");
let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
let CopyPasteAssistent = {
COMMAND_MAP: {
'cut': 'cmd_cut',
@ -81,6 +83,13 @@ let CopyPasteAssistent = {
detail.rect.left += currentRect.left;
detail.rect.right += currentRect.left;
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
let targetDocShell = currentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
if(targetDocShell.isBrowserOrApp) {
break;
}
}
sendAsyncMsg('caretstatechanged', detail);