Backed out changeset e9795d97ccf6 (bug 782850) for M1 failures.
This commit is contained in:
@@ -184,7 +184,7 @@
|
|||||||
<menuitem id="context-reload"
|
<menuitem id="context-reload"
|
||||||
label="&reloadCmd.label;"
|
label="&reloadCmd.label;"
|
||||||
accesskey="&reloadCmd.accesskey;"
|
accesskey="&reloadCmd.accesskey;"
|
||||||
oncommand="gContextMenu.reload(event);"
|
command="Browser:ReloadOrDuplicate"
|
||||||
onclick="checkForMiddleClick(this, event);"/>
|
onclick="checkForMiddleClick(this, event);"/>
|
||||||
<menuitem id="context-stop"
|
<menuitem id="context-stop"
|
||||||
label="&stopCmd.label;"
|
label="&stopCmd.label;"
|
||||||
|
|||||||
@@ -1107,7 +1107,6 @@
|
|||||||
persist="width">
|
persist="width">
|
||||||
<browser id="social-sidebar-browser"
|
<browser id="social-sidebar-browser"
|
||||||
type="content"
|
type="content"
|
||||||
context="contentAreaContextMenu"
|
|
||||||
disableglobalhistory="true"
|
disableglobalhistory="true"
|
||||||
flex="1"
|
flex="1"
|
||||||
style="min-width: 14em; width: 18em; max-width: 36em;"/>
|
style="min-width: 14em; width: 18em; max-width: 36em;"/>
|
||||||
|
|||||||
@@ -4,20 +4,22 @@
|
|||||||
|
|
||||||
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||||
|
|
||||||
function nsContextMenu(aXulMenu, aIsShift) {
|
function nsContextMenu(aXulMenu, aBrowser, aIsShift) {
|
||||||
this.shouldDisplay = true;
|
this.shouldDisplay = true;
|
||||||
this.initMenu(aXulMenu, aIsShift);
|
this.initMenu(aBrowser, aXulMenu, aIsShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prototype for nsContextMenu "class."
|
// Prototype for nsContextMenu "class."
|
||||||
nsContextMenu.prototype = {
|
nsContextMenu.prototype = {
|
||||||
initMenu: function CM_initMenu(aXulMenu, aIsShift) {
|
initMenu: function CM_initMenu(aBrowser, aXulMenu, aIsShift) {
|
||||||
// Get contextual info.
|
// Get contextual info.
|
||||||
this.setTarget(document.popupNode, document.popupRangeParent,
|
this.setTarget(document.popupNode, document.popupRangeParent,
|
||||||
document.popupRangeOffset);
|
document.popupRangeOffset);
|
||||||
if (!this.shouldDisplay)
|
if (!this.shouldDisplay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this.browser = aBrowser;
|
||||||
|
|
||||||
this.hasPageMenu = false;
|
this.hasPageMenu = false;
|
||||||
if (!aIsShift) {
|
if (!aIsShift) {
|
||||||
this.hasPageMenu = PageMenu.maybeBuildAndAttachMenu(this.target,
|
this.hasPageMenu = PageMenu.maybeBuildAndAttachMenu(this.target,
|
||||||
@@ -152,20 +154,13 @@ nsContextMenu.prototype = {
|
|||||||
initNavigationItems: function CM_initNavigationItems() {
|
initNavigationItems: function CM_initNavigationItems() {
|
||||||
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio ||
|
this.onCanvas || this.onVideo || this.onAudio ||
|
||||||
this.onTextInput || this.onSocial);
|
this.onTextInput);
|
||||||
this.showItem("context-back", shouldShow);
|
this.showItem("context-back", shouldShow);
|
||||||
this.showItem("context-forward", shouldShow);
|
this.showItem("context-forward", shouldShow);
|
||||||
|
var shouldShowReload = XULBrowserWindow.stopCommand.getAttribute("disabled") == "true";
|
||||||
let stopped = XULBrowserWindow.stopCommand.getAttribute("disabled") == "true";
|
this.showItem("context-reload", shouldShow && shouldShowReload);
|
||||||
|
this.showItem("context-stop", shouldShow && !shouldShowReload);
|
||||||
let stopReloadItem = "";
|
this.showItem("context-sep-stop", shouldShow);
|
||||||
if (shouldShow || this.onSocial) {
|
|
||||||
stopReloadItem = (stopped || this.onSocial) ? "reload" : "stop";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showItem("context-reload", stopReloadItem == "reload");
|
|
||||||
this.showItem("context-stop", stopReloadItem == "stop");
|
|
||||||
this.showItem("context-sep-stop", !!stopReloadItem);
|
|
||||||
|
|
||||||
// XXX: Stop is determined in browser.js; the canStop broadcaster is broken
|
// XXX: Stop is determined in browser.js; the canStop broadcaster is broken
|
||||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||||
@@ -216,7 +211,7 @@ nsContextMenu.prototype = {
|
|||||||
this.onImage || this.onCanvas ||
|
this.onImage || this.onCanvas ||
|
||||||
this.onVideo || this.onAudio ||
|
this.onVideo || this.onAudio ||
|
||||||
this.onLink || this.onTextInput);
|
this.onLink || this.onTextInput);
|
||||||
var showInspect = !this.onSocial && gPrefService.getBoolPref("devtools.inspector.enabled");
|
var showInspect = gPrefService.getBoolPref("devtools.inspector.enabled");
|
||||||
this.showItem("context-viewsource", shouldShow);
|
this.showItem("context-viewsource", shouldShow);
|
||||||
this.showItem("context-viewinfo", shouldShow);
|
this.showItem("context-viewinfo", shouldShow);
|
||||||
this.showItem("inspect-separator", showInspect);
|
this.showItem("inspect-separator", showInspect);
|
||||||
@@ -273,9 +268,8 @@ nsContextMenu.prototype = {
|
|||||||
// Use "Bookmark This Link" if on a link.
|
// Use "Bookmark This Link" if on a link.
|
||||||
this.showItem("context-bookmarkpage",
|
this.showItem("context-bookmarkpage",
|
||||||
!(this.isContentSelected || this.onTextInput || this.onLink ||
|
!(this.isContentSelected || this.onTextInput || this.onLink ||
|
||||||
this.onImage || this.onVideo || this.onAudio || this.onSocial));
|
this.onImage || this.onVideo || this.onAudio));
|
||||||
this.showItem("context-bookmarklink", (this.onLink && !this.onMailtoLink &&
|
this.showItem("context-bookmarklink", (this.onLink && !this.onMailtoLink) || this.onPlainTextLink);
|
||||||
!this.onSocial) || this.onPlainTextLink);
|
|
||||||
this.showItem("context-searchselect", isTextSelected);
|
this.showItem("context-searchselect", isTextSelected);
|
||||||
this.showItem("context-keywordfield",
|
this.showItem("context-keywordfield",
|
||||||
this.onTextInput && this.onKeywordField);
|
this.onTextInput && this.onKeywordField);
|
||||||
@@ -480,13 +474,6 @@ nsContextMenu.prototype = {
|
|||||||
// Remember the node that was clicked.
|
// Remember the node that was clicked.
|
||||||
this.target = aNode;
|
this.target = aNode;
|
||||||
|
|
||||||
this.browser = this.target.ownerDocument.defaultView
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
|
||||||
.QueryInterface(Ci.nsIDocShell)
|
|
||||||
.chromeEventHandler;
|
|
||||||
this.onSocial = !!this.browser.getAttribute("origin");
|
|
||||||
|
|
||||||
// Check if we are in a synthetic document (stand alone image, video, etc.).
|
// Check if we are in a synthetic document (stand alone image, video, etc.).
|
||||||
this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument;
|
this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument;
|
||||||
// First, do checks for nodes that never have children.
|
// First, do checks for nodes that never have children.
|
||||||
@@ -776,18 +763,6 @@ nsContextMenu.prototype = {
|
|||||||
referrerURI: referrer ? makeURI(referrer) : null });
|
referrerURI: referrer ? makeURI(referrer) : null });
|
||||||
},
|
},
|
||||||
|
|
||||||
reload: function(event) {
|
|
||||||
if (this.onSocial) {
|
|
||||||
// full reload of social provider
|
|
||||||
Social.enabled = false;
|
|
||||||
Services.tm.mainThread.dispatch(function() {
|
|
||||||
Social.enabled = true;
|
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
|
||||||
} else {
|
|
||||||
BrowserReloadOrDuplicate(event);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// View Partial Source
|
// View Partial Source
|
||||||
viewPartialSource: function(aContext) {
|
viewPartialSource: function(aContext) {
|
||||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
oncommand="document.getBindingParent(this).close();"/>
|
oncommand="document.getBindingParent(this).close();"/>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
<xul:iframe anonid="iframe" class="chat-frame" flex="1"
|
<xul:iframe anonid="iframe" class="chat-frame" flex="1"
|
||||||
context="contentAreaContextMenu"
|
|
||||||
xbl:inherits="src,origin,collapsed=minimized" type="content"/>
|
xbl:inherits="src,origin,collapsed=minimized" type="content"/>
|
||||||
</content>
|
</content>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function onPageShow() {
|
|||||||
|
|
||||||
document.popupNode = frame.document.body;
|
document.popupNode = frame.document.body;
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
|
ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function test1Setup() {
|
|||||||
document.popupNode = badFrame.document.firstChild;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
// We'd like to use another load listener here, but error pages don't fire load events
|
// We'd like to use another load listener here, but error pages don't fire load events
|
||||||
contextMenu.showOnlyThisFrame();
|
contextMenu.showOnlyThisFrame();
|
||||||
@@ -69,7 +69,7 @@ function test2Setup() {
|
|||||||
document.popupNode = badFrame.document.firstChild;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
gBrowser.tabContainer.addEventListener("TabOpen", function (event) {
|
gBrowser.tabContainer.addEventListener("TabOpen", function (event) {
|
||||||
test2tab = event.target;
|
test2tab = event.target;
|
||||||
@@ -105,7 +105,7 @@ function test3Setup() {
|
|||||||
document.popupNode = badFrame.document.firstChild;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
Services.ww.registerNotification(function (aSubject, aTopic, aData) {
|
Services.ww.registerNotification(function (aSubject, aTopic, aData) {
|
||||||
if (aTopic == "domwindowopened")
|
if (aTopic == "domwindowopened")
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function test() {
|
|||||||
document.popupNode = element;
|
document.popupNode = element;
|
||||||
|
|
||||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
let contextMenu = new nsContextMenu(contentAreaContextMenu);
|
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
is(contextMenu.shouldDisplay, expected, "context menu behavior for <input type=" + type + "> is wrong");
|
is(contextMenu.shouldDisplay, expected, "context menu behavior for <input type=" + type + "> is wrong");
|
||||||
};
|
};
|
||||||
@@ -26,7 +26,7 @@ function test() {
|
|||||||
document.popupNode = element;
|
document.popupNode = element;
|
||||||
|
|
||||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
let contextMenu = new nsContextMenu(contentAreaContextMenu);
|
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong");
|
is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,6 +102,6 @@ function test() {
|
|||||||
function initContextMenu(aNode) {
|
function initContextMenu(aNode) {
|
||||||
document.popupNode = aNode;
|
document.popupNode = aNode;
|
||||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
let contextMenu = new nsContextMenu(contentAreaContextMenu);
|
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
return contextMenu;
|
return contextMenu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function setSelection(el1, el2, index1, index2) {
|
|||||||
function initContextMenu(aNode) {
|
function initContextMenu(aNode) {
|
||||||
document.popupNode = aNode;
|
document.popupNode = aNode;
|
||||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
let contextMenu = new nsContextMenu(contentAreaContextMenu);
|
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
return contextMenu;
|
return contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
<menupopup id="contentAreaContextMenu" pagemenu="start"
|
<menupopup id="contentAreaContextMenu" pagemenu="start"
|
||||||
onpopupshowing="if (event.target != this)
|
onpopupshowing="if (event.target != this)
|
||||||
return true;
|
return true;
|
||||||
gContextMenu = new nsContextMenu(this, event.shiftKey);
|
gContextMenu = new nsContextMenu(this, getPanelBrowser(), event.shiftKey);
|
||||||
if (gContextMenu.shouldDisplay)
|
if (gContextMenu.shouldDisplay)
|
||||||
document.popupNode = this.triggerNode;
|
document.popupNode = this.triggerNode;
|
||||||
return gContextMenu.shouldDisplay;"
|
return gContextMenu.shouldDisplay;"
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ function testBreadcrumbs(node)
|
|||||||
function _clickOnInspectMenuItem(node) {
|
function _clickOnInspectMenuItem(node) {
|
||||||
document.popupNode = node;
|
document.popupNode = node;
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
return contextMenu.inspectNode();
|
return contextMenu.inspectNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,3 +142,4 @@ function test()
|
|||||||
|
|
||||||
content.location = "data:text/html,basic tests for inspector";
|
content.location = "data:text/html,basic tests for inspector";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user