mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 04:39:03 +02:00
Bug 417483 - Double separator in context menu when selecting empty text & using iframes r=gavin
This commit is contained in:
parent
01b281b7b0
commit
a8cdd9aa97
3 changed files with 31 additions and 2 deletions
|
|
@ -261,16 +261,18 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
initMiscItems: function CM_initMiscItems() {
|
initMiscItems: function CM_initMiscItems() {
|
||||||
|
var isTextSelected = this.isTextSelected;
|
||||||
|
|
||||||
// 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.onImage || this.onVideo || this.onAudio));
|
||||||
this.showItem("context-bookmarklink", this.onLink && !this.onMailtoLink);
|
this.showItem("context-bookmarklink", this.onLink && !this.onMailtoLink);
|
||||||
this.showItem("context-searchselect", this.isTextSelected);
|
this.showItem("context-searchselect", isTextSelected);
|
||||||
this.showItem("context-keywordfield",
|
this.showItem("context-keywordfield",
|
||||||
this.onTextInput && this.onKeywordField);
|
this.onTextInput && this.onKeywordField);
|
||||||
this.showItem("frame", this.inFrame);
|
this.showItem("frame", this.inFrame);
|
||||||
this.showItem("frame-sep", this.inFrame);
|
this.showItem("frame-sep", this.inFrame && isTextSelected);
|
||||||
|
|
||||||
// Hide menu entries for images, show otherwise
|
// Hide menu entries for images, show otherwise
|
||||||
if (this.inFrame) {
|
if (this.inFrame) {
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ _BROWSER_FILES = \
|
||||||
browser_bug405137.js \
|
browser_bug405137.js \
|
||||||
browser_bug409481.js \
|
browser_bug409481.js \
|
||||||
browser_bug413915.js \
|
browser_bug413915.js \
|
||||||
|
browser_bug417483.js \
|
||||||
browser_bug419612.js \
|
browser_bug419612.js \
|
||||||
browser_bug420160.js \
|
browser_bug420160.js \
|
||||||
browser_bug424101.js \
|
browser_bug424101.js \
|
||||||
|
|
|
||||||
26
browser/base/content/test/browser_bug417483.js
Normal file
26
browser/base/content/test/browser_bug417483.js
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
function test() {
|
||||||
|
waitForExplicitFinish();
|
||||||
|
|
||||||
|
var htmlContent = "data:text/html, <iframe src='data:text/html,text text'></iframe>";
|
||||||
|
gBrowser.addEventListener("pageshow", onPageShow, false);
|
||||||
|
gBrowser.loadURI(htmlContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPageShow() {
|
||||||
|
gBrowser.removeEventListener("pageshow", onPageShow, false);
|
||||||
|
var frame = gBrowser.contentWindow.frames[0];
|
||||||
|
var sel = frame.getSelection();
|
||||||
|
var range = frame.document.createRange();
|
||||||
|
var tn = frame.document.body.childNodes[0];
|
||||||
|
range.setStart(tn , 4);
|
||||||
|
range.setEnd(tn , 5);
|
||||||
|
sel.addRange(range);
|
||||||
|
frame.focus();
|
||||||
|
|
||||||
|
document.popupNode = frame.document.body;
|
||||||
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
|
ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
|
||||||
|
finish();
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue