mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
f0c297a16d
--HG-- extra : commitid : Dnaq9WxbL5V
43 lines
996 B
JavaScript
43 lines
996 B
JavaScript
/* globals Services */
|
|
|
|
"use strict";
|
|
|
|
this.EXPORTED_SYMBOLS = ["RemoteNewTabLocation"];
|
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
|
Components.utils.importGlobalProperties(["URL"]);
|
|
|
|
// TODO: will get dynamically set in bug 1210478
|
|
const DEFAULT_PAGE_LOCATION = "https://newtab.cdn.mozilla.net/v0/nightly/en-US/index.html";
|
|
|
|
this.RemoteNewTabLocation = {
|
|
_url: new URL(DEFAULT_PAGE_LOCATION),
|
|
_overridden: false,
|
|
|
|
get href() {
|
|
return this._url.href;
|
|
},
|
|
|
|
get origin() {
|
|
return this._url.origin;
|
|
},
|
|
|
|
get overridden() {
|
|
return this._overridden;
|
|
},
|
|
|
|
override: function(newURL) {
|
|
this._url = new URL(newURL);
|
|
this._overridden = true;
|
|
Services.obs.notifyObservers(null, "remote-new-tab-location-changed",
|
|
this._url.href);
|
|
},
|
|
|
|
reset: function() {
|
|
this._url = new URL(DEFAULT_PAGE_LOCATION);
|
|
this._overridden = false;
|
|
Services.obs.notifyObservers(null, "remote-new-tab-location-changed",
|
|
this._url.href);
|
|
}
|
|
};
|