Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merge mozilla-central to inbound. a=merge CLOSED TREE
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabal committed Nov 15, 2018
2 parents 87e5a97 + 1438e20 commit 3932ec6
Show file tree
Hide file tree
Showing 131 changed files with 1,581 additions and 1,325 deletions.
10 changes: 9 additions & 1 deletion browser/app/blocklist.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<blocklist lastupdate="1541435973146" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<blocklist lastupdate="1542272674851" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem blockID="i334" id="{0F827075-B026-42F3-885D-98981EE7B1AE}">
<prefs/>
Expand Down Expand Up @@ -2404,6 +2404,14 @@
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
<emItem blockID="cd079abe-8e8d-476f-a550-63f75ac09fe8" id="/^((video-downloader@vd\.io)|(image-search-reverse@an\.br)|(YouTube\.Downloader@2\.8)|(eMoji@ems-al\.io))$/">
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
<emItem blockID="03120522-ee87-4cf8-891a-acfb248536ff" id="{97f19f1f-dbb0-4e50-8b46-8091318617bc}">
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p332">
Expand Down
203 changes: 0 additions & 203 deletions browser/components/urlbar/UrlbarController.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
// BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
UrlbarProvidersManager: "resource:///modules/UrlbarProvidersManager.jsm",
UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
});

/**
Expand Down Expand Up @@ -144,100 +143,6 @@ class UrlbarController {
this._notify("onQueryResults", queryContext);
}

/**
* Handles the case where a url or other text has been entered into the
* urlbar. This will either load the URL, or some text that could be a keyword
* or a simple value to load via the default search engine.
*
* @param {Event} event The event that triggered this.
* @param {string} text The text that was entered into the urlbar.
* @param {string} [openWhere] Where we expect the result to be opened.
* @param {object} [openParams]
* The parameters related to how and where the result will be opened.
* For possible properties @see {_loadURL}
*/
handleEnteredText(event, text, openWhere, openParams = {}) {
let where = openWhere || this._whereToOpen(event);

openParams.postData = null;
openParams.allowInheritPrincipal = false;

// TODO: Work out how we get the user selection behavior, probably via passing
// it in, since we don't have the old autocomplete controller to work with.
// BrowserUsageTelemetry.recordUrlbarSelectedResultMethod(
// event, this.userSelectionBehavior);

text = text.trim();

try {
new URL(text);
} catch (ex) {
// TODO: Figure out why we need lastLocationChange here.
// let lastLocationChange = browser.lastLocationChange;
// UrlbarUtils.getShortcutOrURIAndPostData(text).then(data => {
// if (where != "current" ||
// browser.lastLocationChange == lastLocationChange) {
// params.postData = data.postData;
// params.allowInheritPrincipal = data.mayInheritPrincipal;
// this._loadURL(data.url, browser, where,
// openUILinkParams);
// }
// });
return;
}

this._loadURL(text, where, openParams);
}

/**
* Opens a specific result that has been selected.
*
* @param {Event} event The event that triggered this.
* @param {UrlbarMatch} result The result that was selected.
* @param {string} [openWhere] Where we expect the result to be opened.
* @param {object} [openParams]
* The parameters related to how and where the result will be opened.
* For possible properties @see {_loadURL}
*/
resultSelected(event, result, openWhere, openParams = {}) {
// TODO: Work out how we get the user selection behavior, probably via passing
// it in, since we don't have the old autocomplete controller to work with.
// BrowserUsageTelemetry.recordUrlbarSelectedResultMethod(
// event, this.userSelectionBehavior);

let where = openWhere || this._whereToOpen(event);
openParams.postData = null;
openParams.allowInheritPrincipal = false;
let url = result.url;

switch (result.type) {
case UrlbarUtils.MATCH_TYPE.TAB_SWITCH: {
// TODO: Implement handleRevert or equivalent on the input.
// this.input.handleRevert();
let prevTab = this.browserWindow.gBrowser.selectedTab;
let loadOpts = {
adoptIntoActiveWindow: UrlbarPrefs.get("switchTabs.adoptIntoActiveWindow"),
};

if (this.browserWindow.switchToTabHavingURI(url, false, loadOpts) &&
prevTab.isEmpty) {
this.browserWindow.gBrowser.removeTab(prevTab);
}
return;

// TODO: How to handle meta chars?
// Once we get here, we got a TAB_SWITCH match but the user
// bypassed it by pressing shift/meta/ctrl. Those modifiers
// might otherwise affect where we open - we always want to
// open in the current tab.
// where = "current";

}
}

this._loadURL(url, where, openParams);
}

/**
* Adds a listener for query actions and results.
*
Expand Down Expand Up @@ -283,112 +188,4 @@ class UrlbarController {
}
}
}

/**
* Loads the url in the appropriate place.
*
* @param {string} url
* The URL to open.
* @param {string} openUILinkWhere
* Where we expect the result to be opened.
* @param {object} params
* The parameters related to how and where the result will be opened.
* Further supported paramters are listed in utilityOverlay.js#openUILinkIn.
* @param {object} params.triggeringPrincipal
* The principal that the action was triggered from.
* @param {nsIInputStream} [params.postData]
* The POST data associated with a search submission.
* @param {boolean} [params.allowInheritPrincipal]
* If the principal may be inherited
*/
_loadURL(url, openUILinkWhere, params) {
let browser = this.browserWindow.gBrowser.selectedBrowser;

// TODO: These should probably be set by the input field.
// this.value = url;
// browser.userTypedValue = url;
if (this.browserWindow.gInitialPages.includes(url)) {
browser.initialPageLoadedFromURLBar = url;
}
try {
UrlbarUtils.addToUrlbarHistory(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);
}

params.allowThirdPartyFixup = true;

if (openUILinkWhere == "current") {
params.targetBrowser = browser;
params.indicateErrorPageLoad = true;
params.allowPinnedTabHostChange = true;
params.allowPopups = url.startsWith("javascript:");
} else {
params.initiatingDoc = this.browserWindow.document;
}

// Focus the content area before triggering loads, since if the load
// occurs in a new tab, we want focus to be restored to the content
// area when the current tab is re-selected.
browser.focus();

if (openUILinkWhere != "current") {
// TODO: Implement handleRevert or equivalent on the input.
// this.input.handleRevert();
}

try {
this.browserWindow.openTrustedLinkIn(url, openUILinkWhere, params);
} catch (ex) {
// This load can throw an exception in certain cases, which means
// we'll want to replace the URL with the loaded URL:
if (ex.result != Cr.NS_ERROR_LOAD_SHOWED_ERRORPAGE) {
// TODO: Implement handleRevert or equivalent on the input.
// this.input.handleRevert();
}
}

// TODO This should probably be handed via input.
// Ensure the start of the URL is visible for usability reasons.
// this.selectionStart = this.selectionEnd = 0;
}

/**
* Determines where a URL/page should be opened.
*
* @param {Event} event the event triggering the opening.
* @returns {"current" | "tabshifted" | "tab" | "save" | "window"}
*/
_whereToOpen(event) {
let isMouseEvent = event instanceof MouseEvent;
let reuseEmpty = !isMouseEvent;
let where = undefined;
if (!isMouseEvent && event && event.altKey) {
// We support using 'alt' to open in a tab, because ctrl/shift
// might be used for canonizing URLs:
where = event.shiftKey ? "tabshifted" : "tab";
} else if (!isMouseEvent && this._ctrlCanonizesURLs && event && event.ctrlKey) {
// If we're allowing canonization, and this is a key event with ctrl
// pressed, open in current tab to allow ctrl-enter to canonize URL.
where = "current";
} else {
where = this.browserWindow.whereToOpenLink(event, false, false);
}
if (this.openInTab) {
if (where == "current") {
where = "tab";
} else if (where == "tab") {
where = "current";
}
reuseEmpty = true;
}
if (where == "tab" &&
reuseEmpty &&
this.browserWindow.gBrowser.selectedTab.isEmpty) {
where = "current";
}
return where;
}
}
Loading

0 comments on commit 3932ec6

Please sign in to comment.