From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- comm/suite/base/content/about.js | 46 + comm/suite/base/content/about.xhtml | 43 + comm/suite/base/content/aboutLife.xhtml | 72 + comm/suite/base/content/aboutPrivateBrowsing.css | 12 + comm/suite/base/content/aboutPrivateBrowsing.js | 33 + comm/suite/base/content/aboutPrivateBrowsing.xul | 62 + comm/suite/base/content/askViewZoom.js | 43 + comm/suite/base/content/askViewZoom.xul | 27 + comm/suite/base/content/blockedSite.js | 126 ++ comm/suite/base/content/blockedSite.xhtml | 77 + comm/suite/base/content/certError.css | 7 + comm/suite/base/content/certError.js | 181 ++ comm/suite/base/content/certError.xhtml | 164 ++ comm/suite/base/content/certError.xml | 18 + comm/suite/base/content/charsetOverlay.xul | 24 + comm/suite/base/content/communicator.css | 329 ++++ comm/suite/base/content/contentAreaClick.js | 260 +++ .../base/content/contentAreaContextOverlay.xul | 401 ++++ comm/suite/base/content/defaultClientDialog.js | 58 + comm/suite/base/content/defaultClientDialog.xul | 37 + comm/suite/base/content/extensionsOverlay.css | 7 + comm/suite/base/content/findUtils.js | 141 ++ comm/suite/base/content/fullscreen-video.xhtml | 156 ++ comm/suite/base/content/gopherAddon.xhtml | 55 + comm/suite/base/content/helpEditorOverlay.xul | 54 + comm/suite/base/content/helpMessengerOverlay.xul | 57 + comm/suite/base/content/helpSecurityOverlay.xul | 137 ++ comm/suite/base/content/nsContextMenu.js | 1676 +++++++++++++++++ comm/suite/base/content/openLocation.js | 125 ++ comm/suite/base/content/openLocation.xul | 74 + comm/suite/base/content/overrides/app-license.html | 8 + comm/suite/base/content/safeMode.js | 92 + comm/suite/base/content/safeMode.xul | 58 + comm/suite/base/content/tasksOverlay.js | 276 +++ comm/suite/base/content/tasksOverlay.xul | 124 ++ comm/suite/base/content/utilityOverlay.js | 1969 ++++++++++++++++++++ comm/suite/base/content/utilityOverlay.xul | 719 +++++++ comm/suite/base/content/viewApplyThemeOverlay.js | 170 ++ comm/suite/base/content/viewApplyThemeOverlay.xul | 34 + comm/suite/base/content/viewSourceOverlay.js | 32 + comm/suite/base/content/viewSourceOverlay.xul | 81 + comm/suite/base/content/viewZoomOverlay.js | 479 +++++ comm/suite/base/content/viewZoomOverlay.xul | 55 + comm/suite/base/jar.mn | 96 + comm/suite/base/moz.build | 17 + 45 files changed, 8712 insertions(+) create mode 100644 comm/suite/base/content/about.js create mode 100644 comm/suite/base/content/about.xhtml create mode 100644 comm/suite/base/content/aboutLife.xhtml create mode 100644 comm/suite/base/content/aboutPrivateBrowsing.css create mode 100644 comm/suite/base/content/aboutPrivateBrowsing.js create mode 100644 comm/suite/base/content/aboutPrivateBrowsing.xul create mode 100644 comm/suite/base/content/askViewZoom.js create mode 100644 comm/suite/base/content/askViewZoom.xul create mode 100644 comm/suite/base/content/blockedSite.js create mode 100644 comm/suite/base/content/blockedSite.xhtml create mode 100644 comm/suite/base/content/certError.css create mode 100644 comm/suite/base/content/certError.js create mode 100644 comm/suite/base/content/certError.xhtml create mode 100644 comm/suite/base/content/certError.xml create mode 100644 comm/suite/base/content/charsetOverlay.xul create mode 100644 comm/suite/base/content/communicator.css create mode 100644 comm/suite/base/content/contentAreaClick.js create mode 100644 comm/suite/base/content/contentAreaContextOverlay.xul create mode 100644 comm/suite/base/content/defaultClientDialog.js create mode 100644 comm/suite/base/content/defaultClientDialog.xul create mode 100644 comm/suite/base/content/extensionsOverlay.css create mode 100644 comm/suite/base/content/findUtils.js create mode 100644 comm/suite/base/content/fullscreen-video.xhtml create mode 100644 comm/suite/base/content/gopherAddon.xhtml create mode 100644 comm/suite/base/content/helpEditorOverlay.xul create mode 100644 comm/suite/base/content/helpMessengerOverlay.xul create mode 100644 comm/suite/base/content/helpSecurityOverlay.xul create mode 100644 comm/suite/base/content/nsContextMenu.js create mode 100644 comm/suite/base/content/openLocation.js create mode 100644 comm/suite/base/content/openLocation.xul create mode 100644 comm/suite/base/content/overrides/app-license.html create mode 100644 comm/suite/base/content/safeMode.js create mode 100644 comm/suite/base/content/safeMode.xul create mode 100644 comm/suite/base/content/tasksOverlay.js create mode 100644 comm/suite/base/content/tasksOverlay.xul create mode 100644 comm/suite/base/content/utilityOverlay.js create mode 100644 comm/suite/base/content/utilityOverlay.xul create mode 100644 comm/suite/base/content/viewApplyThemeOverlay.js create mode 100644 comm/suite/base/content/viewApplyThemeOverlay.xul create mode 100644 comm/suite/base/content/viewSourceOverlay.js create mode 100644 comm/suite/base/content/viewSourceOverlay.xul create mode 100644 comm/suite/base/content/viewZoomOverlay.js create mode 100644 comm/suite/base/content/viewZoomOverlay.xul create mode 100644 comm/suite/base/jar.mn create mode 100644 comm/suite/base/moz.build (limited to 'comm/suite/base') diff --git a/comm/suite/base/content/about.js b/comm/suite/base/content/about.js new file mode 100644 index 0000000000..15e3ebad4d --- /dev/null +++ b/comm/suite/base/content/about.js @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + +window.onload = function () { + // get release notes URL and vendor URL from prefs + var releaseNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL"); + if (releaseNotesURL != "about:blank") { + var relnotes = document.getElementById("releaseNotesURL"); + relnotes.href = releaseNotesURL; + } + + var vendorURL = Services.urlFormatter.formatURLPref("app.vendorURL"); + if (vendorURL != "about:blank") { + var vendor = document.getElementById("vendorURL"); + vendor.href = vendorURL; + } + + // append the version of the XUL application (!= XULRunner platform version) + var versionNum = AppConstants.MOZ_APP_VERSION_DISPLAY; + var version = document.getElementById("version"); + version.appendChild(document.createTextNode(versionNum)); + + // append user agent + var ua = navigator.userAgent; + if (ua) { + var uaItem = document.getElementById("userAgent"); + uaItem.appendChild(document.createTextNode(ua)); + uaItem.hidden = false; + } + + // append build identifier + var buildId = Services.appinfo.appBuildID; + if (buildId) { + var buildItem = document.getElementById("buildID"); + buildItem.appendChild(document.createTextNode(buildId)); + buildItem.hidden = false; + } + + // Determine and display current channel. + document.getElementById("currentChannel").textContent = + Services.prefs.getDefaultBranch("").getCharPref("app.update.channel"); +} diff --git a/comm/suite/base/content/about.xhtml b/comm/suite/base/content/about.xhtml new file mode 100644 index 0000000000..7303f040a8 --- /dev/null +++ b/comm/suite/base/content/about.xhtml @@ -0,0 +1,43 @@ + + + +%brandDTD; + +%globalDTD; + +%suiteAboutDTD; +]> + + + + + + About: + + + + + + + + +

+ + + diff --git a/comm/suite/base/content/aboutPrivateBrowsing.css b/comm/suite/base/content/aboutPrivateBrowsing.css new file mode 100644 index 0000000000..14f610a5e4 --- /dev/null +++ b/comm/suite/base/content/aboutPrivateBrowsing.css @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#warningBox:not(.private) .private, +#warningBox:not(.normal) .normal { + display: none; +} + +.title { + background-size: auto; +} diff --git a/comm/suite/base/content/aboutPrivateBrowsing.js b/comm/suite/base/content/aboutPrivateBrowsing.js new file mode 100644 index 0000000000..202bc4dbc8 --- /dev/null +++ b/comm/suite/base/content/aboutPrivateBrowsing.js @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +window.onload = function () { + if (window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsILoadContext) + .usePrivateBrowsing) { + document.getElementById("warningBox").className = "private"; + document.title = document.getElementById("privateTitle").textContent; + } + else { + document.getElementById("warningBox").className = "normal"; + document.title = document.getElementById("normalTitle").textContent; + } + + document.getElementById("learnMoreButton") + .addEventListener("command", function() { + openHelp("private-browsing", + "chrome://communicator/locale/help/suitehelp.rdf"); + }); + + document.getElementById("closeWindowButton") + .addEventListener("command", function() { + window.close(); + }); + + document.getElementById("privateWindowButton") + .addEventListener("command", function() { + openNewPrivateWith(location.href); + }); +} diff --git a/comm/suite/base/content/aboutPrivateBrowsing.xul b/comm/suite/base/content/aboutPrivateBrowsing.xul new file mode 100644 index 0000000000..30361ef38f --- /dev/null +++ b/comm/suite/base/content/aboutPrivateBrowsing.xul @@ -0,0 +1,62 @@ + + + + + + + + + + %brandDTD; + + %aboutPrivateBrowsingDTD; +]> + + + + + +

+ + + diff --git a/comm/suite/base/content/communicator.css b/comm/suite/base/content/communicator.css new file mode 100644 index 0000000000..6ec458f0df --- /dev/null +++ b/comm/suite/base/content/communicator.css @@ -0,0 +1,329 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +/* ::::: print preview toolbar ::::: */ + +toolbar[printpreview="true"] { + -moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar"); +} + +/* ::::: autocomplete textbox ::::: */ + +textbox[type="autocomplete"] { + -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete"); +} + +panel[type="autocomplete"] { + -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-result-popup"); +} + +.autocomplete-history-popup { + -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-history-popup"); +} + +.autocomplete-treebody { + -moz-binding: url("chrome://global/content/autocomplete.xml#autocomplete-treebody"); +} + +panel[type="autocomplete-richlistbox"] { + -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup"); +} + +.autocomplete-richlistbox { + -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistbox"); + -moz-user-focus: ignore; +} + +.autocomplete-richlistbox > scrollbox { + overflow-x: hidden !important; +} + +.autocomplete-history-dropmarker { + -moz-binding: url("chrome://global/content/autocomplete.xml#history-dropmarker"); +} + +.autocomplete-richlistitem { + -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistitem"); + -moz-box-orient: vertical; + overflow: -moz-hidden-unscrollable; +} + +/* ::::: notification box ::::: */ + +.browser-notificationbox { + -moz-binding: url("chrome://communicator/content/bindings/notification.xml#browser-notificationbox"); +} + +.browser-notificationbox[popupnotification="true"] { + -moz-binding: url("chrome://communicator/content/bindings/notification.xml#popup-notification"); +} + +notification[value="addon-install-started"] { + -moz-binding: url("chrome://communicator/content/bindings/notification.xml#addon-progress-notification"); +} + +/* ::::: toolbaritem ::::: */ +toolbaritem { + -moz-binding: url("chrome://global/content/bindings/general.xml#basecontrol"); +} + +/* With the move to the new toolkit, SeaMonkey needs to overwrite certain bindings + * if it wants to keep its distinctive likeness. The now hidden new toolkit bindings + * will stay accessible via a set xpfe="false" attribute, though, where necessary. + */ + +/******* toolkit access layer *******/ +/* These rules reintroduce the toolkit bindings overwritten later below */ +toolbox[xpfe="false"] { + -moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#toolbox"); +} + +toolbox[xpfe="false"] > toolbar, +toolbar[xpfe="false"][type="menubar"], +toolbar[xpfe="false"] { + -moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#toolbar"); +} + +menubar[xpfe="false"], +toolbar > toolbaritem > menubar, +toolbar > menubar { + -moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#menubar"); +} + +toolbar > toolbarpaletteitem > toolbaritem > menubar { + -moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#menubar") !important; +} + +.menubar-items { + -moz-box-orient: vertical; /* for flex hack */ +} + +.menubar-items > menubar { + -moz-box-flex: 1; /* make menu items expand to fill toolbar height */ +} + +prefwindow, +prefwindow:root, +prefpane { + -moz-box-orient: vertical; +} + +prefwindow[type="child"] > .paneDeckContainer { + overflow: -moz-hidden-unscrollable; +} + +prefwindow[type="child"] > prefpane > .content-box { + -moz-box-flex: 1; + overflow: -moz-hidden-unscrollable; +} + +preferences { + -moz-binding: url("chrome://communicator/content/bindings/preferences.xml#preferences"); + visibility: collapse; +} + +preference { + -moz-binding: url("chrome://communicator/content/bindings/preferences.xml#preference"); + visibility: collapse; +} + +radio[pane] { + -moz-binding: url("chrome://communicator/content/bindings/preferences.xml#panebutton") !important; + -moz-box-orient: vertical; + -moz-box-align: center; +} + +prefwindow[chromehidden~="toolbar"] .chromeclass-toolbar { + display: none; +} + +prefwindow[xpfe="false"] { + -moz-binding: url("chrome://communicator/content/bindings/preferences.xml#prefwindow"); +} + +prefpane[xpfe="false"] { + -moz-binding: url("chrome://communicator/content/bindings/preferences.xml#prefpane"); +} + +findbar[xpfe="false"] { + -moz-binding: url("chrome://global/content/bindings/findbar.xml#findbar"); +} + +prefwindow[xpfe="false"] > .paneDeckContainer, +prefpane[xpfe="false"] > .content-box { + overflow: hidden; +} + +/******* SeaMonkey XPFE *******/ +/* These bindings reflect SeaMonkey XPFE, modulo new toolkit features. */ +toolbox { + -moz-binding: url("chrome://communicator/content/bindings/toolbar-xpfe.xml#grippytoolbox"); +} + +toolbar { + -moz-binding: url("chrome://communicator/content/bindings/toolbar-xpfe.xml#grippytoolbar"); +} + +toolbar[type="menubar"] { + -moz-binding: url("chrome://communicator/content/bindings/toolbar-xpfe.xml#grippytoolbar-menubar"); +} + +toolbargrippy { + -moz-binding: url("chrome://communicator/content/bindings/toolbar-xpfe.xml#toolbargrippy"); +} + +menubar { + -moz-binding: url("chrome://communicator/content/bindings/toolbar-xpfe.xml#grippymenubar"); +} + +prefwindow { + -moz-binding: url("chrome://communicator/content/bindings/prefwindow.xml#prefwindow"); +} + +prefpane { + -moz-binding: url("chrome://communicator/content/bindings/prefwindow.xml#prefpane"); +} + +findbar { + -moz-binding: url("chrome://communicator/content/bindings/findbar.xml#findbar"); +} + +prefwindow > .paneDeckContainer, +prefpane > .content-box { + overflow: visible; +} + +prefwindow[overflow="auto"] > .paneDeckContainer, +prefwindow[overflow="auto"] prefpane > .content-box { + overflow: auto; +} + +dialogheader { + -moz-binding: url("chrome://communicator/content/bindings/generalBindings.xml#dialogheader"); +} + +%ifndef MOZ_WIDGET_GTK +statusbar:not([nowindowdrag="true"]) { + -moz-window-dragging: drag; +} +%endif + +%ifdef XP_MACOSX +.statusbar-resizerpanel { + display: none; +} +%else +window[sizemode="maximized"] statusbarpanel.statusbar-resizerpanel { + visibility: collapse; +} +%endif + +statusbar { + -moz-binding: url("chrome://communicator/content/bindings/generalBindings.xml#statusbar"); +%ifdef XP_MACOSX + padding-right: 14px; +%endif +} + +statusbarpanel { + -moz-binding: url("chrome://communicator/content/bindings/generalBindings.xml#statusbarpanel"); +} + +.statusbarpanel-iconic { + -moz-binding: url("chrome://communicator/content/bindings/general.xml#statusbarpanel-iconic"); +} + +.statusbarpanel-iconic-text { + -moz-binding: url("chrome://communicator/content/bindings/general.xml#statusbarpanel-iconic-text"); +} + +.statusbarpanel-backgroundbox { + -moz-binding: url("chrome://communicator/content/bindings/general.xml#statusbarpanel-backgroundbox"); +} + +textbox[enablehistory="true"] > .autocomplete-history-dropmarker { + display: -moz-box; +} + +/******* lightweight themes *******/ +:root:-moz-lwtheme { + color: var(--lwt-text-color) !important +} + +/** + * [customization-lwtheme] may or may not be used yet; we leave it in + * in case it moves to toolkit in the future. + */ +:root:-moz-lwtheme:not([customization-lwtheme]) { + background-color: var(--lwt-accent-color) !important; + background-image: var(--lwt-header-image) !important; +} + +window[lwtheme="true"] { + background-repeat: no-repeat; + background-position: top right; + background-image: var(--lwt-header-image); +} + +:root[lwthemefooter="true"] #status-bar:-moz-lwtheme { + background-repeat: no-repeat; + background-position: bottom left; + background-color: var(--lwt-accent-color); + background-image: var(--lwt-header-image); +} + +/******* sync *******/ +#sync-notifications { + -moz-binding: url("chrome://communicator/content/sync/syncNotification.xml#notificationbox"); + overflow-y: visible !important; +} + +#sync-notifications > notification { + -moz-binding: url("chrome://communicator/content/sync/syncNotification.xml#notification"); +} + +/******* autohide toolbars *******/ + +toolbar[type="menubar"][autohide="true"] +{ + -moz-binding: url("chrome://communicator/content/bindings/toolbar.xml#toolbar-menubar-autohide"); + overflow: hidden; +} + +toolbar[type="menubar"][autohide="true"][inactive="true"] +{ + min-height: 0px !important; + height: 0px !important; + -moz-appearance: none !important; + border-style: none !important; +} + +/******* datepicker *******/ +datepicker { + -moz-binding: url("chrome://communicator/content/bindings/datetimepicker.xml#datepicker"); +} + +datepicker[type="popup"] { + -moz-binding: url("chrome://communicator/content/bindings/datetimepicker.xml#datepicker-popup"); +} + +datepicker[type="grid"] { + -moz-binding: url("chrome://communicator/content/bindings/datetimepicker.xml#datepicker-grid"); +} + +/******* numberbox *******/ +textbox[type="number"] { + -moz-binding: url("chrome://communicator/content/bindings/numberbox.xml#numberbox"); +} + +/******* spinbuttons *******/ +spinbuttons { + -moz-binding: url("chrome://communicator/content/bindings/spinbuttons.xml#spinbuttons"); +} + +.spinbuttons-button { + -moz-user-focus: ignore; +} diff --git a/comm/suite/base/content/contentAreaClick.js b/comm/suite/base/content/contentAreaClick.js new file mode 100644 index 0000000000..b4c83e991e --- /dev/null +++ b/comm/suite/base/content/contentAreaClick.js @@ -0,0 +1,260 @@ +// /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * - [ Dependencies ] --------------------------------------------------------- + * utilityOverlay.js: + * - gatherTextUnder + */ + + function hrefAndLinkNodeForClickEvent(event) + { + var href = ""; + var isKeyCommand = (event.type == "command"); + var linkNode = isKeyCommand ? document.commandDispatcher.focusedElement + : event.originalTarget; + + while (linkNode instanceof Element) { + if (linkNode instanceof HTMLAnchorElement || + linkNode instanceof HTMLAreaElement || + linkNode instanceof HTMLLinkElement) { + href = linkNode.href; + if (href) + break; + } + // Try MathML href + else if (linkNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" && + linkNode.hasAttribute("href")) { + href = linkNode.getAttribute("href"); + href = makeURLAbsolute(linkNode.baseURI, href); + break; + } + // Try simple XLink + else if (linkNode.hasAttributeNS("http://www.w3.org/1999/xlink", "href")) { + href = linkNode.getAttributeNS("http://www.w3.org/1999/xlink", "href"); + href = makeURLAbsolute(linkNode.baseURI, href); + break; + } + linkNode = linkNode.parentNode; + } + + return href ? {href: href, linkNode: linkNode} : null; + } + + // Called whenever the user clicks in the content area, + // except when left-clicking on links (special case) + // should always return true for click to go through + function contentAreaClick(event) + { + if (!event.isTrusted || event.defaultPrevented) { + return true; + } + + var isKeyCommand = (event.type == "command"); + var ceParams = hrefAndLinkNodeForClickEvent(event); + if (ceParams) { + var href = ceParams.href; + if (isKeyCommand) { + var doc = event.target.ownerDocument; + urlSecurityCheck(href, doc.nodePrincipal); + openLinkIn(href, event && event.altKey ? "tabshifted" : "tab", + { charset: doc.characterSet, + referrerURI: doc.documentURIObject }); + event.stopPropagation(); + } + else { + // if in mailnews block the link left click if we determine + // that this URL is phishy (i.e. a potential email scam) + if ("gMessengerBundle" in this && event.button < 2 && + isPhishingURL(ceParams.linkNode, false, href)) + return false; + handleLinkClick(event, href, ceParams.linkNode); + + // Mark the page as a user followed link. This is done so that history can + // distinguish automatic embed visits from user activated ones. For example + // pages loaded in frames are embed visits and lost with the session, while + // visits across frames should be preserved. + try { + PlacesUIUtils.markPageAsFollowedLink(href); + } catch (ex) { /* Skip invalid URIs. */ } + } + return true; + } + + if (!isKeyCommand && event.button == 1 && + Services.prefs.getBoolPref("middlemouse.contentLoadURL") && + !Services.prefs.getBoolPref("general.autoScroll")) { + middleMousePaste(event); + } + + return true; + } + +function handleLinkClick(event, href, linkNode) { + if (event.button == 2) // right click + return false; + + var where = whereToOpenLink(event); + if (where == "current") + return false; + + var doc = event.target.ownerDocument; + + if (where == "save") { + saveURL(href, linkNode ? gatherTextUnder(linkNode) : "", null, false, + true, doc.documentURIObject, doc); + event.preventDefault(); + return true; + } + + var referrerURI = doc.documentURIObject; + // if the mixedContentChannel is present and the referring URI passes + // a same origin check with the target URI, we can preserve the users + // decision of disabling MCB on a page for it's child tabs. + var persistAllowMixedContentInChildTab = false; + + if (where == "tab" && getBrowser().docShell.mixedContentChannel) { + const sm = Services.scriptSecurityManager; + try { + var targetURI = makeURI(href); + sm.checkSameOriginURI(referrerURI, targetURI, false); + persistAllowMixedContentInChildTab = true; + } + catch (e) { } + } + + urlSecurityCheck(href, doc.nodePrincipal); + let params = { + charset: doc.characterSet, + private: gPrivate ? true : false, + allowMixedContent: persistAllowMixedContentInChildTab, + referrerURI: referrerURI, + noReferrer: BrowserUtils.linkHasNoReferrer(linkNode), + originPrincipal: doc.nodePrincipal, + triggeringPrincipal: doc.nodePrincipal, + }; + + // The new tab/window must use the same userContextId + if (doc.nodePrincipal.originAttributes.userContextId) { + params.userContextId = doc.nodePrincipal.originAttributes.userContextId; + } + + openLinkIn(href, where, params); + event.preventDefault(); + return true; +} + + function middleMousePaste(event) { + + let clipboard = readFromClipboard(); + + if (!clipboard) + return; + + // Strip embedded newlines and surrounding whitespace, to match the URL + // bar's behavior (stripsurroundingwhitespace). + clipboard = clipboard.replace(/\s*\n\s*/g, ""); + + clipboard = stripUnsafeProtocolOnPaste(clipboard); + + // If its not the current tab, we don't need to do anything because the + // browser doesn't exist. + let where = whereToOpenLink(event, true, false); + let lastLocationChange; + if (where == "current") { + lastLocationChange = gBrowser.selectedBrowser.lastLocationChange; + } + + getShortcutOrURIAndPostData(clipboard).then(data => { + try { + makeURI(data.url); + } catch (ex) { + // Not a valid URI. + return; + } + + try { + addToUrlbarHistory(data.url); + } catch (ex) { + // Things may go wrong when adding url to session history, + // but don't let that interfere with the loading of the url. + Cu.reportError(ex); + } + + if (where != "current" || + lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) { + openUILink(data.url, event, + { ignoreButton: true, + disallowInheritPrincipal: !data.mayInheritPrincipal }); + } + }); + + event.stopPropagation(); + } + + function stripUnsafeProtocolOnPaste(pasteData) { + // Don't allow pasting javascript URIs since we don't support + // LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL for those. + let changed = false; + let pasteDataNoJS = pasteData.replace(/\r?\n/g, "") + .replace(/^(?:\s*javascript:)+/i, + () => { changed = true; + return ""; }); + return changed ? pasteDataNoJS : pasteData; + } + + function addToUrlbarHistory(aUrlToAdd) + { + if (gPrivate) + return; + + if (!Services.prefs.getBoolPref("browser.urlbar.historyEnabled")) + return; + + // Remove leading and trailing spaces first. + aUrlToAdd = aUrlToAdd.trim(); + + if (!aUrlToAdd) + return; + // Don't store bad URLs. + if (aUrlToAdd.search(/[\x00-\x1F]/) != -1) + return; + + getShortcutOrURIAndPostData(aUrlToAdd).then(data => { + var fixedUpURI = Services.uriFixup.createFixupURI(data.url, 0); + if (!fixedUpURI.schemeIs("data")) + PlacesUtils.history.markPageAsTyped(fixedUpURI); + }).catch(() => {}); + + // Open or create the urlbar history database. + var file = GetUrlbarHistoryFile(); + var connection = Services.storage.openDatabase(file); + connection.beginTransaction(); + if (!connection.tableExists("urlbarhistory")) + connection.createTable("urlbarhistory", "url TEXT"); + + // If the URL is already present in the database then remove it from + // its current position. It is then reinserted at the top of the list. + var statement = connection.createStatement( + "DELETE FROM urlbarhistory WHERE LOWER(url) = LOWER(?1)"); + statement.bindByIndex(0, aUrlToAdd); + statement.execute(); + statement.finalize(); + + // Put the value as it was typed by the user in to urlbar history. + statement = connection.createStatement( + "INSERT INTO urlbarhistory (url) VALUES (?1)"); + statement.bindByIndex(0, aUrlToAdd); + statement.execute(); + statement.finalize(); + + // Remove any expired history items so that we don't let + // this grow without bound. + connection.executeSimpleSQL( + "DELETE FROM urlbarhistory WHERE ROWID NOT IN " + + "(SELECT ROWID FROM urlbarhistory ORDER BY ROWID DESC LIMIT 30)"); + connection.commitTransaction(); + connection.close(); + } diff --git a/comm/suite/base/content/contentAreaContextOverlay.xul b/comm/suite/base/content/contentAreaContextOverlay.xul new file mode 100644 index 0000000000..57601b7d94 --- /dev/null +++ b/comm/suite/base/content/contentAreaContextOverlay.xul @@ -0,0 +1,401 @@ + + + + + + + + + + +
+