зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1123904 - Provide url highlighting in reader mode. r=margaret
--HG-- extra : rebase_source : 3656fb2c5e00ac1a67e157e27476c48ea82ee4b5
This commit is contained in:
Родитель
4fa07c2a94
Коммит
ac47a44320
|
@ -179,6 +179,10 @@ public class Tab {
|
|||
return mUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base domain of the loaded uri. Note that if the page is
|
||||
* a Reader mode uri, the base domain returned is that of the original uri.
|
||||
*/
|
||||
public String getBaseDomain() {
|
||||
return mBaseDomain;
|
||||
}
|
||||
|
|
|
@ -4430,7 +4430,11 @@ Tab.prototype = {
|
|||
this.clickToPlayPluginsActivated = false;
|
||||
// Borrowed from desktop Firefox: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/urlbarBindings.xml#174
|
||||
let documentURI = contentWin.document.documentURIObject.spec
|
||||
let matchedURL = documentURI.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
|
||||
|
||||
// If reader mode, get the base domain for the original url.
|
||||
let strippedURI = this._stripAboutReaderURL(documentURI);
|
||||
|
||||
let matchedURL = strippedURI.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
|
||||
let baseDomain = "";
|
||||
if (matchedURL) {
|
||||
var domain = "";
|
||||
|
@ -4488,6 +4492,19 @@ Tab.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_stripAboutReaderURL: function (url) {
|
||||
if (!url.startsWith("about:reader")) {
|
||||
return url;
|
||||
}
|
||||
|
||||
// From ReaderParent._getOriginalUrl (browser/modules/ReaderParent.jsm).
|
||||
let searchParams = new URLSearchParams(url.substring("about:reader?".length));
|
||||
if (!searchParams.has("url")) {
|
||||
return url;
|
||||
}
|
||||
return decodeURIComponent(searchParams.get("url"));
|
||||
},
|
||||
|
||||
// Properties used to cache security state used to update the UI
|
||||
_state: null,
|
||||
_hostChanged: false, // onLocationChange will flip this bit
|
||||
|
|
Загрузка…
Ссылка в новой задаче