mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge m-c to fx-team
This commit is contained in:
commit
e0a2f8b053
@ -229,6 +229,9 @@ body[narrow] #launcher[session] {
|
||||
padding: 14px 6px;
|
||||
min-width: 88px;
|
||||
max-width: 176px;
|
||||
max-height: 85px;
|
||||
vertical-align: top;
|
||||
white-space: normal;
|
||||
background: transparent padding-box;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2.5px;
|
||||
@ -241,9 +244,6 @@ body[narrow] #launcher[session] {
|
||||
|
||||
body[narrow] #launcher[session] > .launchButton {
|
||||
margin: 4px 1px;
|
||||
max-height: 85px;
|
||||
vertical-align: top;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.launchButton:hover {
|
||||
|
@ -110,6 +110,15 @@ let gBrowserThumbnails = {
|
||||
|
||||
let channel = aBrowser.docShell.currentDocumentChannel;
|
||||
|
||||
// No valid document channel. We shouldn't take a screenshot.
|
||||
if (!channel)
|
||||
return false;
|
||||
|
||||
// Don't take screenshots of internally redirecting about: pages.
|
||||
// This includes error pages.
|
||||
if (channel.originalURI.schemeIs("about"))
|
||||
return false;
|
||||
|
||||
try {
|
||||
// If the channel is a nsIHttpChannel get its http status code.
|
||||
let httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
@ -94,7 +94,11 @@ let gDrop = {
|
||||
// A new link was dragged onto the grid. Create it by pinning its URL.
|
||||
let dt = aEvent.dataTransfer;
|
||||
let [url, title] = dt.getData("text/x-moz-url").split(/[\r\n]+/);
|
||||
gPinnedLinks.pin({url: url, title: title}, index);
|
||||
let link = {url: url, title: title};
|
||||
gPinnedLinks.pin(link, index);
|
||||
|
||||
// Make sure the newly added link is not blocked.
|
||||
gBlockedLinks.unblock(link);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -92,6 +92,7 @@ nsContextMenu.prototype = {
|
||||
} catch (e) { }
|
||||
this.isTextSelected = this.isTextSelection();
|
||||
this.isContentSelected = this.isContentSelection();
|
||||
this.onPlainTextLink = false;
|
||||
|
||||
// Initialize (disable/remove) menu items.
|
||||
this.initItems();
|
||||
@ -132,7 +133,6 @@ nsContextMenu.prototype = {
|
||||
|
||||
// Time to do some bad things and see if we've highlighted a URL that
|
||||
// isn't actually linked.
|
||||
var onPlainTextLink = false;
|
||||
if (this.isTextSelected && !this.onLink) {
|
||||
// Ok, we have some text, let's figure out if it looks like a URL.
|
||||
let selection = document.commandDispatcher.focusedWindow
|
||||
@ -190,14 +190,14 @@ nsContextMenu.prototype = {
|
||||
if (uri && uri.host) {
|
||||
this.linkURI = uri;
|
||||
this.linkURL = this.linkURI.spec;
|
||||
onPlainTextLink = true;
|
||||
this.onPlainTextLink = true;
|
||||
}
|
||||
}
|
||||
|
||||
var shouldShow = this.onSaveableLink || isMailtoInternal || onPlainTextLink;
|
||||
var shouldShow = this.onSaveableLink || isMailtoInternal || this.onPlainTextLink;
|
||||
this.showItem("context-openlink", shouldShow);
|
||||
this.showItem("context-openlinkintab", shouldShow);
|
||||
this.showItem("context-openlinkincurrent", onPlainTextLink);
|
||||
this.showItem("context-openlinkincurrent", this.onPlainTextLink);
|
||||
this.showItem("context-sep-open", shouldShow);
|
||||
},
|
||||
|
||||
@ -222,9 +222,9 @@ nsContextMenu.prototype = {
|
||||
this.showItem("context-savepage", shouldShow);
|
||||
this.showItem("context-sendpage", shouldShow);
|
||||
|
||||
// Save+Send link depends on whether we're in a link.
|
||||
this.showItem("context-savelink", this.onSaveableLink);
|
||||
this.showItem("context-sendlink", this.onSaveableLink);
|
||||
// Save+Send link depends on whether we're in a link, or selected text matches valid URL pattern.
|
||||
this.showItem("context-savelink", this.onSaveableLink || this.onPlainTextLink);
|
||||
this.showItem("context-sendlink", this.onSaveableLink || this.onPlainTextLink);
|
||||
|
||||
// Save image depends on having loaded its content, video and audio don't.
|
||||
this.showItem("context-saveimage", this.onLoadedImage || this.onCanvas);
|
||||
@ -310,7 +310,7 @@ nsContextMenu.prototype = {
|
||||
this.showItem("context-bookmarkpage",
|
||||
!(this.isContentSelected || this.onTextInput || this.onLink ||
|
||||
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.showItem("context-searchselect", isTextSelected);
|
||||
this.showItem("context-keywordfield",
|
||||
this.onTextInput && this.onKeywordField);
|
||||
@ -1073,9 +1073,15 @@ nsContextMenu.prototype = {
|
||||
// Save URL of clicked-on link.
|
||||
saveLink: function() {
|
||||
var doc = this.target.ownerDocument;
|
||||
var linkText;
|
||||
// If selected text is found to match valid URL pattern.
|
||||
if (this.onPlainTextLink)
|
||||
linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim();
|
||||
else
|
||||
linkText = this.linkText();
|
||||
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
|
||||
|
||||
this.saveHelper(this.linkURL, this.linkText(), null, true, doc);
|
||||
this.saveHelper(this.linkURL, linkText, null, true, doc);
|
||||
},
|
||||
|
||||
sendLink: function() {
|
||||
@ -1390,8 +1396,14 @@ nsContextMenu.prototype = {
|
||||
},
|
||||
|
||||
bookmarkLink: function CM_bookmarkLink() {
|
||||
var linkText;
|
||||
// If selected text is found to match valid URL pattern.
|
||||
if (this.onPlainTextLink)
|
||||
linkText = document.commandDispatcher.focusedWindow.getSelection().toString().trim();
|
||||
else
|
||||
linkText = this.linkText();
|
||||
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId, this.linkURL,
|
||||
this.linkText());
|
||||
linkText);
|
||||
},
|
||||
|
||||
addBookmarkForFrame: function CM_addBookmarkForFrame() {
|
||||
|
@ -25,6 +25,7 @@ _BROWSER_FILES = \
|
||||
browser_newtab_bug723121.js \
|
||||
browser_newtab_bug725996.js \
|
||||
browser_newtab_bug734043.js \
|
||||
browser_newtab_bug735987.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
22
browser/base/content/test/newtab/browser_newtab_bug735987.js
Normal file
22
browser/base/content/test/newtab/browser_newtab_bug735987.js
Normal file
@ -0,0 +1,22 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function runTests() {
|
||||
setLinks("0,1,2,3,4,5,6,7,8");
|
||||
setPinnedLinks("");
|
||||
|
||||
yield addNewTabPageTab();
|
||||
checkGrid("0,1,2,3,4,5,6,7,8");
|
||||
|
||||
yield simulateDrop(cells[1]);
|
||||
checkGrid("0,99p,1,2,3,4,5,6,7");
|
||||
|
||||
yield blockCell(cells[1]);
|
||||
checkGrid("0,1,2,3,4,5,6,7,8");
|
||||
|
||||
yield simulateDrop(cells[1]);
|
||||
checkGrid("0,99p,1,2,3,4,5,6,7");
|
||||
|
||||
yield blockCell(cells[1]);
|
||||
checkGrid("0,1,2,3,4,5,6,7,8");
|
||||
}
|
@ -58,6 +58,8 @@ Browser context menu subtest.
|
||||
<menuitem></menuitem>
|
||||
</menu>
|
||||
</div>
|
||||
<div id="test-select-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</div>
|
||||
<div id="test-select-text-link">http://mozilla.com</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -20,6 +20,7 @@ Browser context menu tests.
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
@ -72,6 +73,16 @@ function invokeItemAction(generatedItemId)
|
||||
ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
|
||||
}
|
||||
|
||||
function selectText(element) {
|
||||
// Clear any previous selections before selecting new element.
|
||||
subwindow.getSelection().removeAllRanges();
|
||||
|
||||
var div = subwindow.document.createRange();
|
||||
div.setStartBefore(element);
|
||||
div.setEndAfter(element);
|
||||
subwindow.getSelection().addRange(div);
|
||||
}
|
||||
|
||||
function getVisibleMenuItems(aMenu, aData) {
|
||||
var items = [];
|
||||
var accessKeys = {};
|
||||
@ -667,6 +678,45 @@ function runTest(testNum) {
|
||||
"context-viewinfo", true
|
||||
].concat(inspectItems));
|
||||
closeContextMenu();
|
||||
selectText(selecttext); // Select text prior to opening context menu.
|
||||
openContextMenuFor(selecttext); // Invoke context menu for next test.
|
||||
return;
|
||||
|
||||
case 22:
|
||||
// Context menu for selected text
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-copy", true,
|
||||
"context-selectall", true,
|
||||
"---", null,
|
||||
"context-searchselect", true,
|
||||
"context-viewpartialsource-selection", true
|
||||
].concat(inspectItems));
|
||||
}
|
||||
closeContextMenu();
|
||||
selectText(selecttextlink); // Select text prior to opening context menu.
|
||||
openContextMenuFor(selecttextlink); // Invoke context menu for next test.
|
||||
return;
|
||||
|
||||
case 23:
|
||||
// Context menu for selected text which matches valid URL pattern
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-openlinkincurrent", true,
|
||||
"context-openlinkintab", true,
|
||||
"context-openlink", true,
|
||||
"---", null,
|
||||
"context-bookmarklink", true,
|
||||
"context-savelink", true,
|
||||
"context-sendlink", true,
|
||||
"context-copy", true,
|
||||
"context-selectall", true,
|
||||
"---", null,
|
||||
"context-searchselect", true,
|
||||
"context-viewpartialsource-selection", true
|
||||
].concat(inspectItems));
|
||||
}
|
||||
closeContextMenu();
|
||||
|
||||
subwindow.close();
|
||||
SimpleTest.finish();
|
||||
@ -674,7 +724,6 @@ function runTest(testNum) {
|
||||
|
||||
/*
|
||||
* Other things that would be nice to test:
|
||||
* - selected text
|
||||
* - spelling / misspelled word (in text input?)
|
||||
* - check state of disabled items
|
||||
* - test execution of menu items (maybe as a separate test?)
|
||||
@ -734,6 +783,8 @@ function startTest() {
|
||||
contenteditable.focus(); // content editable needs to be focused to enable spellcheck
|
||||
inputspell = subwindow.document.getElementById("test-input-spellcheck");
|
||||
pagemenu = subwindow.document.getElementById("test-pagemenu");
|
||||
selecttext = subwindow.document.getElementById("test-select-text");
|
||||
selecttextlink = subwindow.document.getElementById("test-select-text-link");
|
||||
|
||||
contextMenu.addEventListener("popupshown", function() { runTest(++testNum); }, false);
|
||||
runTest(1);
|
||||
|
@ -109,6 +109,7 @@ let PageThumbs = {
|
||||
* @param aCallback The function to be called when finished (optional).
|
||||
*/
|
||||
captureAndStore: function PageThumbs_captureAndStore(aBrowser, aCallback) {
|
||||
let url = aBrowser.currentURI.spec;
|
||||
this.capture(aBrowser.contentWindow, function (aInputStream) {
|
||||
let telemetryStoreTime = new Date();
|
||||
|
||||
@ -123,7 +124,7 @@ let PageThumbs = {
|
||||
}
|
||||
|
||||
// Get a writeable cache entry.
|
||||
PageThumbsCache.getWriteEntry(aBrowser.currentURI.spec, function (aEntry) {
|
||||
PageThumbsCache.getWriteEntry(url, function (aEntry) {
|
||||
if (!aEntry) {
|
||||
finish(false);
|
||||
return;
|
||||
|
@ -13,6 +13,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_thumbnails_capture.js \
|
||||
browser_thumbnails_bug726727.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* These tests ensure that capturing a sites's thumbnail, saving it and
|
||||
* retrieving it from the cache works.
|
||||
*/
|
||||
function runTests() {
|
||||
// Create a tab that shows an error page.
|
||||
let tab = gBrowser.addTab("http://non-existant.url/");
|
||||
let browser = tab.linkedBrowser;
|
||||
|
||||
yield browser.addEventListener("DOMContentLoaded", function onLoad() {
|
||||
browser.removeEventListener("DOMContentLoaded", onLoad, false);
|
||||
executeSoon(next);
|
||||
}, false);
|
||||
|
||||
ok(!gBrowserThumbnails._shouldCapture(browser), "we're not going to capture an error page");
|
||||
}
|
@ -383,6 +383,15 @@ let BlockedLinks = {
|
||||
Storage.set("blockedLinks", this.links);
|
||||
},
|
||||
|
||||
/**
|
||||
* Unblocks a given link.
|
||||
* @param aLink The link to unblock.
|
||||
*/
|
||||
unblock: function BlockedLinks_unblock(aLink) {
|
||||
if (this.isBlocked(aLink))
|
||||
delete this.links[aLink.url];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns whether a given link is blocked.
|
||||
* @param aLink The link to check.
|
||||
|
Loading…
Reference in New Issue
Block a user