[Pkg-mozext-commits] [firegestures] 10/18: fix some commands on frame
David Prévot
taffit at moszumanska.debian.org
Sat May 23 10:58:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firegestures.
commit 73eec23700ec3b01040d7c37d5903208bc86377a
Author: Gomita <gomita at xuldev.org>
Date: Sun May 17 01:50:06 2015 +0900
fix some commands on frame
---
chrome/content/firegestures/browser.js | 54 +++++++++++++++++++++++++++++-----
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/chrome/content/firegestures/browser.js b/chrome/content/firegestures/browser.js
index d9df854..3be7b26 100644
--- a/chrome/content/firegestures/browser.js
+++ b/chrome/content/firegestures/browser.js
@@ -335,6 +335,7 @@ var FireGestures = {
if (docShell.isCommandEnabled(aCommand))
docShell.doCommand(aCommand);
break;
+ // @see nsContextMenu::showOnlyThisFrame()
case "FireGestures:ShowOnlyThisFrame":
var doc = this.sourceNode.ownerDocument;
var docURL = doc.location.href;
@@ -342,19 +343,58 @@ var FireGestures = {
this.checkURL(docURL, doc.defaultView.top.document, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILinkIn(docURL, "current", { disallowInheritPrincipal: true, referrerURI: refURI });
break;
+ // @see nsContextMenu::openFrame()
+ // @see nsContextMenu::openFrameInTab()
case "FireGestures:OpenFrame":
case "FireGestures:OpenFrameInTab":
+ var doc = this.sourceNode.ownerDocument;
+ var docURL = doc.location.href;
+ var refURI = doc.referrer ? makeURI(doc.referrer) : null;
+ openLinkIn(docURL, aCommand == "FireGestures:OpenFrame" ? "window" : "tab", {
+ charset: doc.characterSet, referrerURI: refURI
+ });
+ break;
case "FireGestures:ReloadFrame":
+ this.sourceNode.ownerDocument.location.reload();
+ break;
+ // @see nsContextMenu::addBookmarkForFrame()
case "FireGestures:AddBookmarkForFrame":
+ var doc = this.sourceNode.ownerDocument;
+ var docURI = makeURI(doc.location.href);
+ var itemId = PlacesUtils.getMostRecentBookmarkForURI(docURI);
+ if (itemId == -1) {
+ PlacesUIUtils.showBookmarkDialog({
+ action: "add", type: "bookmark", uri: docURI, title: doc.title,
+ description: PlacesUIUtils.getDescriptionFromDocument(doc),
+ hiddenRows: ["description", "location", "loadInSidebar", "keyword" ]
+ }, window.top);
+ }
+ else {
+ PlacesUIUtils.showBookmarkDialog({
+ action: "edit", type: "bookmark", itemId: itemId
+ }, window.top);
+ }
+ break;
case "FireGestures:SaveFrame":
+ saveDocument(this.sourceNode.ownerDocument);
+ break;
+ // @see nsContextMenu::viewFrameSource
case "FireGestures:ViewFrameSource":
+ // [e10s]
+ if (this.isRemote) {
+ var doc = this.sourceNode.ownerDocument;
+ var frameID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
+ BrowserViewSourceOfDocument({
+ browser: gBrowser.mCurrentBrowser, URL: doc.location.href,
+ outerWindowID: frameID
+ });
+ return;
+ }
+ BrowserViewSourceOfDocument(this.sourceNode.ownerDocument);
+ break;
case "FireGestures:ViewFrameInfo":
- // XXXtotally hack!
- var funcName = aCommand.substr("FireGestures:".length);
- funcName = funcName.charAt(0).toLowerCase() + funcName.substr(1);
- nsContextMenu.prototype.target = this.sourceNode;
- try { nsContextMenu.prototype[funcName](); }
- finally { nsContextMenu.prototype.target = null; }
+ BrowserPageInfo(this.sourceNode.ownerDocument);
break;
// @see nsContextMenu::openLink()
// @see nsContextMenu::openLinkInPrivateWindow()
@@ -510,7 +550,7 @@ var FireGestures = {
if (this.getSelectedText())
nsContextMenu.prototype.viewPartialSource("selection");
else
- BrowserViewSourceOfDocument(this.sourceNode.ownerDocument);
+ this._performAction(event, "FireGestures:ViewFrameSource");
break;
case "FireGestures:AllTabsPopup":
case "FireGestures:BFHistoryPopup":
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firegestures.git
More information about the Pkg-mozext-commits
mailing list