Bug 1522502 - Support displaying about:reader URLs. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D17510

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2019-01-24 19:43:37 +00:00
Родитель 89d4f21d5f
Коммит f4f4709dc2
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -47,7 +47,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
ReaderMode: "resource://gre/modules/ReaderMode.jsm",
ReaderParent: "resource:///modules/ReaderParent.jsm",
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
@ -81,6 +80,11 @@ if (AppConstants.MOZ_CRASHREPORTER) {
"resource:///modules/ContentCrashHandlers.jsm");
}
if (!Services.prefs.getBoolPref("browser.urlbar.quantumbar", false)) {
ChromeUtils.defineModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
}
XPCOMUtils.defineLazyScriptGetter(this, "PlacesTreeView",
"chrome://browser/content/places/treeView.js");
XPCOMUtils.defineLazyScriptGetter(this, ["PlacesInsertionPoint", "PlacesController",

Просмотреть файл

@ -12,6 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
ExtensionSearchHandler: "resource://gre/modules/ExtensionSearchHandler.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
ReaderMode: "resource://gre/modules/ReaderMode.jsm",
Services: "resource://gre/modules/Services.jsm",
UrlbarController: "resource:///modules/UrlbarController.jsm",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
@ -161,7 +162,7 @@ class UrlbarInput {
makeURIReadable(uri) {
// Avoid copying 'about:reader?url=', and always provide the original URI:
// Reader mode ensures we call createExposableURI itself.
let readerStrippedURI = this.window.ReaderMode.getOriginalUrlObjectForDisplay(uri.displaySpec);
let readerStrippedURI = ReaderMode.getOriginalUrlObjectForDisplay(uri.displaySpec);
if (readerStrippedURI) {
return readerStrippedURI;
}
@ -491,6 +492,11 @@ class UrlbarInput {
set value(val) {
this._untrimmedValue = val;
let originalUrl = ReaderMode.getOriginalUrlObjectForDisplay(val);
if (originalUrl) {
val = originalUrl.displaySpec;
}
val = this.trimValue(val);
this.valueIsTyped = false;