mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Merge mozilla-central to b2g-inbound on a CLOSED TREE
This commit is contained in:
commit
b48b9014ff
@ -1257,7 +1257,11 @@ nsAccessibilityService::Init()
|
||||
logging::CheckEnv();
|
||||
#endif
|
||||
|
||||
gApplicationAccessible = new ApplicationAccessibleWrap();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
gApplicationAccessible = new ApplicationAccessibleWrap();
|
||||
else
|
||||
gApplicationAccessible = new ApplicationAccessible();
|
||||
|
||||
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@ -1274,7 +1278,8 @@ nsAccessibilityService::Init()
|
||||
gIsShutdown = false;
|
||||
|
||||
// Now its safe to start platform accessibility.
|
||||
PlatformInit();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
PlatformInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1316,7 +1321,9 @@ nsAccessibilityService::Shutdown()
|
||||
|
||||
gIsShutdown = true;
|
||||
|
||||
PlatformShutdown();
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default)
|
||||
PlatformShutdown();
|
||||
|
||||
gApplicationAccessible->Shutdown();
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nullptr;
|
||||
|
@ -328,6 +328,7 @@ pref("media.eme.apiVisible", true);
|
||||
pref("media.video-queue.default-size", 3);
|
||||
|
||||
// optimize images' memory usage
|
||||
pref("image.downscale-during-decode.enabled", true);
|
||||
pref("image.decode-only-on-draw.enabled", false);
|
||||
pref("image.mem.allow_locking_in_content_processes", true);
|
||||
// Limit the surface cache to 1/8 of main memory or 128MB, whichever is smaller.
|
||||
|
@ -1345,10 +1345,9 @@ pref("devtools.devedition.promo.url", "https://www.mozilla.org/firefox/developer
|
||||
// Disable the error console
|
||||
pref("devtools.errorconsole.enabled", false);
|
||||
|
||||
// Developer toolbar and GCLI preferences
|
||||
// Developer toolbar preferences
|
||||
pref("devtools.toolbar.enabled", true);
|
||||
pref("devtools.toolbar.visible", false);
|
||||
pref("devtools.commands.dir", "");
|
||||
|
||||
// Enable the app manager
|
||||
pref("devtools.appmanager.enabled", true);
|
||||
@ -1520,17 +1519,6 @@ sticky_pref("devtools.theme", "dark");
|
||||
sticky_pref("devtools.theme", "light");
|
||||
#endif
|
||||
|
||||
// Display the introductory text
|
||||
pref("devtools.gcli.hideIntro", false);
|
||||
|
||||
// How eager are we to show help: never=1, sometimes=2, always=3
|
||||
pref("devtools.gcli.eagerHelper", 2);
|
||||
|
||||
// Alias to the script URLs for inject command.
|
||||
pref("devtools.gcli.jquerySrc", "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
|
||||
pref("devtools.gcli.lodashSrc", "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js");
|
||||
pref("devtools.gcli.underscoreSrc", "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js");
|
||||
|
||||
// Remember the Web Console filters
|
||||
pref("devtools.webconsole.filter.network", true);
|
||||
pref("devtools.webconsole.filter.networkinfo", false);
|
||||
@ -1622,11 +1610,6 @@ pref("devtools.fontinspector.enabled", true);
|
||||
// version for each user.
|
||||
pref("devtools.telemetry.tools.opened.version", "{}");
|
||||
|
||||
// Set imgur upload client ID
|
||||
pref("devtools.gcli.imgurClientID", '0df414e888d7240');
|
||||
// Imgur's upload URL
|
||||
pref("devtools.gcli.imgurUploadURL", "https://api.imgur.com/3/image");
|
||||
|
||||
// Whether the character encoding menu is under the main Firefox button. This
|
||||
// preference is a string so that localizers can alter it.
|
||||
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
|
||||
@ -1807,6 +1790,9 @@ pref("identity.fxaccounts.remote.force_auth.uri", "https://accounts.firefox.com/
|
||||
// The remote content URL shown for signin in. Must use HTTPS.
|
||||
pref("identity.fxaccounts.remote.signin.uri", "https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v1");
|
||||
|
||||
// The remote content URL where FxAccountsWebChannel messages originate.
|
||||
pref("identity.fxaccounts.remote.webchannel.uri", "https://accounts.firefox.com/");
|
||||
|
||||
// The URL we take the user to when they opt to "manage" their Firefox Account.
|
||||
// Note that this will always need to be in the same TLD as the
|
||||
// "identity.fxaccounts.remote.signup.uri" pref.
|
||||
@ -1917,7 +1903,7 @@ pref("reader.parse-node-limit", 0);
|
||||
pref("dom.serviceWorkers.enabled", true);
|
||||
#endif
|
||||
|
||||
pref("browser.pocket.enabled", false);
|
||||
pref("browser.pocket.enabled", true);
|
||||
pref("browser.pocket.api", "api.getpocket.com");
|
||||
pref("browser.pocket.site", "getpocket.com");
|
||||
pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
|
||||
|
@ -206,6 +206,7 @@ let gEMEHandler = {
|
||||
let options = {
|
||||
dismissed: true,
|
||||
eventCallback: aTopic => aTopic == "swapping",
|
||||
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
|
||||
};
|
||||
PopupNotifications.show(browser, "drmContentPlaying", message, anchorId, mainAction, null, options);
|
||||
},
|
||||
|
@ -88,6 +88,14 @@ let gFxAccounts = {
|
||||
// notified of fxa-migration:state-changed in response if necessary.
|
||||
Services.obs.notifyObservers(null, "fxa-migration:state-request", null);
|
||||
|
||||
let contentUri = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.webchannel.uri");
|
||||
// The FxAccountsWebChannel listens for events and updates
|
||||
// the state machine accordingly.
|
||||
let fxAccountsWebChannel = new FxAccountsWebChannel({
|
||||
content_uri: contentUri,
|
||||
channel_id: this.FxAccountsCommon.WEBCHANNEL_ID
|
||||
});
|
||||
|
||||
this._initialized = true;
|
||||
|
||||
this.updateUI();
|
||||
@ -403,3 +411,6 @@ XPCOMUtils.defineLazyGetter(gFxAccounts, "FxAccountsCommon", function () {
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(gFxAccounts, "fxaMigrator",
|
||||
"resource://services-sync/FxaMigrator.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsWebChannel",
|
||||
"resource://gre/modules/FxAccountsWebChannel.jsm");
|
||||
|
@ -13,7 +13,7 @@ support-files =
|
||||
browser_bug970746.xhtml
|
||||
browser_fxa_oauth.html
|
||||
browser_fxa_oauth_with_keys.html
|
||||
browser_fxa_profile_channel.html
|
||||
browser_fxa_web_channel.html
|
||||
browser_registerProtocolHandler_notification.html
|
||||
browser_ssl_error_reports_content.js
|
||||
browser_star_hsts.sjs
|
||||
@ -238,7 +238,7 @@ skip-if = e10s && debug
|
||||
[browser_bug624734.js]
|
||||
[browser_bug633691.js]
|
||||
[browser_bug647886.js]
|
||||
skip-if = buildapp == 'mulet' || e10s # Bug 1093373 - Relies on browser.sessionHistory
|
||||
skip-if = buildapp == 'mulet'
|
||||
[browser_bug655584.js]
|
||||
[browser_bug664672.js]
|
||||
[browser_bug676619.js]
|
||||
@ -302,7 +302,7 @@ skip-if = e10s
|
||||
skip-if = buildapp == 'mulet' || e10s || os == "linux" # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly. Linux: Intermittent failures - bug 941575.
|
||||
[browser_fxa_migrate.js]
|
||||
[browser_fxa_oauth.js]
|
||||
[browser_fxa_profile_channel.js]
|
||||
[browser_fxa_web_channel.js]
|
||||
[browser_gestureSupport.js]
|
||||
skip-if = e10s # Bug 863514 - no gesture support.
|
||||
[browser_getshortcutoruri.js]
|
||||
|
@ -1,36 +1,25 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
add_task(function* () {
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.history.pushState({}, "2", "2.html");
|
||||
});
|
||||
|
||||
testBackButton();
|
||||
}, true);
|
||||
|
||||
loadURI("http://example.com");
|
||||
}
|
||||
|
||||
function testBackButton() {
|
||||
var backButton = document.getElementById("back-button");
|
||||
var rect = backButton.getBoundingClientRect();
|
||||
|
||||
info("waiting for the history menu to open");
|
||||
|
||||
backButton.addEventListener("popupshown", function (event) {
|
||||
backButton.removeEventListener("popupshown", arguments.callee, false);
|
||||
|
||||
ok(true, "history menu opened");
|
||||
event.target.hidePopup();
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
finish();
|
||||
}, false);
|
||||
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(backButton, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(backButton, {type: "mousedown"});
|
||||
EventUtils.synthesizeMouse(backButton, rect.width / 2, rect.height, {type: "mouseup"});
|
||||
}
|
||||
let event = yield popupShownPromise;
|
||||
|
||||
ok(true, "history menu opened");
|
||||
|
||||
event.target.hidePopup();
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>fxa_profile_channel_test</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
window.onload = function(){
|
||||
var event = new window.CustomEvent("WebChannelMessageToChrome", {
|
||||
detail: {
|
||||
id: "account_updates",
|
||||
message: {
|
||||
command: "profile:change",
|
||||
data: {
|
||||
uid: "abc123",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,90 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () {
|
||||
return Components.utils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsProfileChannel",
|
||||
"resource://gre/modules/FxAccountsProfileChannel.jsm");
|
||||
|
||||
const HTTP_PATH = "http://example.com";
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "FxA Profile Channel - should receive message about account updates",
|
||||
run: function* () {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let tabOpened = false;
|
||||
let properUrl = "http://example.com/browser/browser/base/content/test/general/browser_fxa_profile_channel.html";
|
||||
|
||||
waitForTab(function (tab) {
|
||||
Assert.ok("Tab successfully opened");
|
||||
let match = gBrowser.currentURI.spec == properUrl;
|
||||
Assert.ok(match);
|
||||
|
||||
tabOpened = true;
|
||||
});
|
||||
|
||||
let client = new FxAccountsProfileChannel({
|
||||
content_uri: HTTP_PATH,
|
||||
});
|
||||
|
||||
makeObserver(FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION, function (subject, topic, data) {
|
||||
Assert.ok(tabOpened);
|
||||
Assert.equal(data, "abc123");
|
||||
resolve();
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab(properUrl);
|
||||
});
|
||||
}
|
||||
}
|
||||
]; // gTests
|
||||
|
||||
function makeObserver(aObserveTopic, aObserveFunc) {
|
||||
let callback = function (aSubject, aTopic, aData) {
|
||||
if (aTopic == aObserveTopic) {
|
||||
removeMe();
|
||||
aObserveFunc(aSubject, aTopic, aData);
|
||||
}
|
||||
};
|
||||
|
||||
function removeMe() {
|
||||
Services.obs.removeObserver(callback, aObserveTopic);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(callback, aObserveTopic, false);
|
||||
return removeMe;
|
||||
}
|
||||
|
||||
function waitForTab(aCallback) {
|
||||
let container = gBrowser.tabContainer;
|
||||
container.addEventListener("TabOpen", function tabOpener(event) {
|
||||
container.removeEventListener("TabOpen", tabOpener, false);
|
||||
gBrowser.addEventListener("load", function listener() {
|
||||
gBrowser.removeEventListener("load", listener, true);
|
||||
let tab = event.target;
|
||||
aCallback(tab);
|
||||
}, true);
|
||||
}, false);
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Task.spawn(function () {
|
||||
for (let test of gTests) {
|
||||
info("Running: " + test.desc);
|
||||
yield test.run();
|
||||
}
|
||||
}).then(finish, ex => {
|
||||
Assert.ok(false, "Unexpected Exception: " + ex);
|
||||
finish();
|
||||
});
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>fxa_web_channel_test</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var webChannelId = "account_updates_test";
|
||||
|
||||
window.onload = function(){
|
||||
var testName = window.location.search.replace(/^\?/, "");
|
||||
|
||||
switch(testName) {
|
||||
case "profile_change":
|
||||
test_profile_change();
|
||||
break;
|
||||
case "login":
|
||||
test_login();
|
||||
break;
|
||||
case "can_link_account":
|
||||
test_can_link_account();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
function test_profile_change() {
|
||||
var event = new window.CustomEvent("WebChannelMessageToChrome", {
|
||||
detail: {
|
||||
id: webChannelId,
|
||||
message: {
|
||||
command: "profile:change",
|
||||
data: {
|
||||
uid: "abc123",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function test_login() {
|
||||
var event = new window.CustomEvent("WebChannelMessageToChrome", {
|
||||
detail: {
|
||||
id: webChannelId,
|
||||
message: {
|
||||
command: "fxaccounts:login",
|
||||
data: {
|
||||
authAt: Date.now(),
|
||||
email: "testuser@testuser.com",
|
||||
keyFetchToken: 'key_fetch_token',
|
||||
sessionToken: 'session_token',
|
||||
uid: 'uid',
|
||||
unwrapBKey: 'unwrap_b_key',
|
||||
verified: true,
|
||||
},
|
||||
messageId: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function test_can_link_account() {
|
||||
window.addEventListener("WebChannelMessageToContent", function (e) {
|
||||
// echo any responses from the browser back to the tests on the
|
||||
// fxaccounts_webchannel_response_echo WebChannel. The tests are
|
||||
// listening for events and do the appropriate checks.
|
||||
var event = new window.CustomEvent("WebChannelMessageToChrome", {
|
||||
detail: {
|
||||
id: 'fxaccounts_webchannel_response_echo',
|
||||
message: e.detail.message,
|
||||
}
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
}, true);
|
||||
|
||||
var event = new window.CustomEvent("WebChannelMessageToChrome", {
|
||||
detail: {
|
||||
id: webChannelId,
|
||||
message: {
|
||||
command: "fxaccounts:can_link_account",
|
||||
data: {
|
||||
email: "testuser@testuser.com",
|
||||
},
|
||||
messageId: 2,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
153
browser/base/content/test/general/browser_fxa_web_channel.js
Normal file
153
browser/base/content/test/general/browser_fxa_web_channel.js
Normal file
@ -0,0 +1,153 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () {
|
||||
return Components.utils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
|
||||
"resource://gre/modules/WebChannel.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsWebChannel",
|
||||
"resource://gre/modules/FxAccountsWebChannel.jsm");
|
||||
|
||||
const TEST_HTTP_PATH = "http://example.com";
|
||||
const TEST_BASE_URL = TEST_HTTP_PATH + "/browser/browser/base/content/test/general/browser_fxa_web_channel.html";
|
||||
const TEST_CHANNEL_ID = "account_updates_test";
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "FxA Web Channel - should receive message about profile changes",
|
||||
run: function* () {
|
||||
let client = new FxAccountsWebChannel({
|
||||
content_uri: TEST_HTTP_PATH,
|
||||
channel_id: TEST_CHANNEL_ID,
|
||||
});
|
||||
let promiseObserver = new Promise((resolve, reject) => {
|
||||
makeObserver(FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION, function (subject, topic, data) {
|
||||
Assert.equal(data, "abc123");
|
||||
client.tearDown();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser: gBrowser,
|
||||
url: TEST_BASE_URL + "?profile_change"
|
||||
}, function* () {
|
||||
yield promiseObserver;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
desc: "fxa web channel - login messages should notify the fxAccounts object",
|
||||
run: function* () {
|
||||
|
||||
let promiseLogin = new Promise((resolve, reject) => {
|
||||
let login = (accountData) => {
|
||||
Assert.equal(typeof accountData.authAt, 'number');
|
||||
Assert.equal(accountData.email, 'testuser@testuser.com');
|
||||
Assert.equal(accountData.keyFetchToken, 'key_fetch_token');
|
||||
Assert.equal(accountData.sessionToken, 'session_token');
|
||||
Assert.equal(accountData.uid, 'uid');
|
||||
Assert.equal(accountData.unwrapBKey, 'unwrap_b_key');
|
||||
Assert.equal(accountData.verified, true);
|
||||
|
||||
client.tearDown();
|
||||
resolve();
|
||||
};
|
||||
|
||||
let client = new FxAccountsWebChannel({
|
||||
content_uri: TEST_HTTP_PATH,
|
||||
channel_id: TEST_CHANNEL_ID,
|
||||
helpers: {
|
||||
login: login
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser: gBrowser,
|
||||
url: TEST_BASE_URL + "?login"
|
||||
}, function* () {
|
||||
yield promiseLogin;
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
desc: "fxa web channel - can_link_account messages should respond",
|
||||
run: function* () {
|
||||
let properUrl = TEST_BASE_URL + "?can_link_account";
|
||||
|
||||
let promiseEcho = new Promise((resolve, reject) => {
|
||||
|
||||
let webChannelOrigin = Services.io.newURI(properUrl, null, null);
|
||||
// responses sent to content are echoed back over the
|
||||
// `fxaccounts_webchannel_response_echo` channel. Ensure the
|
||||
// fxaccounts:can_link_account message is responded to.
|
||||
let echoWebChannel = new WebChannel('fxaccounts_webchannel_response_echo', webChannelOrigin);
|
||||
echoWebChannel.listen((webChannelId, message, target) => {
|
||||
Assert.equal(message.command, 'fxaccounts:can_link_account');
|
||||
Assert.equal(message.messageId, 2);
|
||||
Assert.equal(message.data.ok, true);
|
||||
|
||||
client.tearDown();
|
||||
echoWebChannel.stopListening();
|
||||
|
||||
resolve();
|
||||
});
|
||||
|
||||
let client = new FxAccountsWebChannel({
|
||||
content_uri: TEST_HTTP_PATH,
|
||||
channel_id: TEST_CHANNEL_ID,
|
||||
helpers: {
|
||||
shouldAllowRelink(acctName) {
|
||||
return acctName === 'testuser@testuser.com';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser: gBrowser,
|
||||
url: properUrl
|
||||
}, function* () {
|
||||
yield promiseEcho;
|
||||
});
|
||||
}
|
||||
}
|
||||
]; // gTests
|
||||
|
||||
function makeObserver(aObserveTopic, aObserveFunc) {
|
||||
let callback = function (aSubject, aTopic, aData) {
|
||||
if (aTopic == aObserveTopic) {
|
||||
removeMe();
|
||||
aObserveFunc(aSubject, aTopic, aData);
|
||||
}
|
||||
};
|
||||
|
||||
function removeMe() {
|
||||
Services.obs.removeObserver(callback, aObserveTopic);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(callback, aObserveTopic, false);
|
||||
return removeMe;
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
Task.spawn(function () {
|
||||
for (let test of gTests) {
|
||||
info("Running: " + test.desc);
|
||||
yield test.run();
|
||||
}
|
||||
}).then(finish, ex => {
|
||||
Assert.ok(false, "Unexpected Exception: " + ex);
|
||||
finish();
|
||||
});
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 65 KiB |
@ -26,8 +26,8 @@
|
||||
# settings.
|
||||
# The dialog units for the bitmap's dimensions should match exactly with the
|
||||
# bitmap's width and height in pixels.
|
||||
!define APPNAME_BMP_WIDTH_DU 93u
|
||||
!define APPNAME_BMP_HEIGHT_DU 44u
|
||||
!define APPNAME_BMP_WIDTH_DU 123u
|
||||
!define APPNAME_BMP_HEIGHT_DU 56u
|
||||
!define INTRO_BLURB_WIDTH_DU "232u"
|
||||
!define INTRO_BLURB_EDGE_DU "196u"
|
||||
!define INTRO_BLURB_LTR_TOP_DU "16u"
|
||||
|
@ -34,8 +34,6 @@
|
||||
|
||||
// Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
|
||||
"camelcase": 0, // TODO: Remove (use default)
|
||||
"comma-dangle": 0, // TODO: Remove (use default)
|
||||
"comma-spacing": 0, // TODO: Remove (use default)
|
||||
"consistent-return": 0, // TODO: Remove (use default)
|
||||
"curly": 0, // TODO: Remove (use default)
|
||||
"dot-notation": 0, // TODO: Remove (use default)
|
||||
|
@ -115,7 +115,7 @@ loop.Client = (function($) {
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
return Client;
|
||||
|
@ -157,7 +157,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
|
||||
getInitialState: function () {
|
||||
return {
|
||||
openDirUp: false,
|
||||
openDirUp: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -175,7 +175,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
if (menuNodeRect.top + menuNodeRect.height >=
|
||||
listNodeRect.top + listNodeRect.height) {
|
||||
this.setState({
|
||||
openDirUp: true,
|
||||
openDirUp: true
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -232,7 +232,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
const ContactDetail = React.createClass({displayName: "ContactDetail",
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showMenu: false,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -351,7 +351,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
importBusy: false,
|
||||
filter: "",
|
||||
filter: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -633,7 +633,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
pristine: true,
|
||||
name: "",
|
||||
email: "",
|
||||
tel: "",
|
||||
tel: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -651,7 +651,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
handleAcceptButtonClick: function() {
|
||||
// Allow validity error indicators to be displayed.
|
||||
this.setState({
|
||||
pristine: false,
|
||||
pristine: false
|
||||
});
|
||||
|
||||
let emailInput = this.refs.email.getDOMNode();
|
||||
@ -677,7 +677,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
}
|
||||
});
|
||||
this.setState({
|
||||
contact: null,
|
||||
contact: null
|
||||
});
|
||||
break;
|
||||
case "add":
|
||||
@ -752,6 +752,6 @@ loop.contacts = (function(_, mozL10n) {
|
||||
ContactsList: ContactsList,
|
||||
ContactDetailsForm: ContactDetailsForm,
|
||||
_getPreferred: getPreferred,
|
||||
_setPreferred: setPreferred,
|
||||
_setPreferred: setPreferred
|
||||
};
|
||||
})(_, document.mozL10n);
|
||||
|
@ -157,7 +157,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
|
||||
getInitialState: function () {
|
||||
return {
|
||||
openDirUp: false,
|
||||
openDirUp: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -175,7 +175,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
if (menuNodeRect.top + menuNodeRect.height >=
|
||||
listNodeRect.top + listNodeRect.height) {
|
||||
this.setState({
|
||||
openDirUp: true,
|
||||
openDirUp: true
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -232,7 +232,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
const ContactDetail = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showMenu: false,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -351,7 +351,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
importBusy: false,
|
||||
filter: "",
|
||||
filter: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -633,7 +633,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
pristine: true,
|
||||
name: "",
|
||||
email: "",
|
||||
tel: "",
|
||||
tel: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -651,7 +651,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
handleAcceptButtonClick: function() {
|
||||
// Allow validity error indicators to be displayed.
|
||||
this.setState({
|
||||
pristine: false,
|
||||
pristine: false
|
||||
});
|
||||
|
||||
let emailInput = this.refs.email.getDOMNode();
|
||||
@ -677,7 +677,7 @@ loop.contacts = (function(_, mozL10n) {
|
||||
}
|
||||
});
|
||||
this.setState({
|
||||
contact: null,
|
||||
contact: null
|
||||
});
|
||||
break;
|
||||
case "add":
|
||||
@ -752,6 +752,6 @@ loop.contacts = (function(_, mozL10n) {
|
||||
ContactsList: ContactsList,
|
||||
ContactDetailsForm: ContactDetailsForm,
|
||||
_getPreferred: getPreferred,
|
||||
_setPreferred: setPreferred,
|
||||
_setPreferred: setPreferred
|
||||
};
|
||||
})(_, document.mozL10n);
|
||||
|
@ -139,7 +139,7 @@ loop.conversation = (function(mozL10n) {
|
||||
loop.store.StoreMixin.register({
|
||||
conversationAppStore: conversationAppStore,
|
||||
conversationStore: conversationStore,
|
||||
feedbackStore: feedbackStore,
|
||||
feedbackStore: feedbackStore
|
||||
});
|
||||
|
||||
// Obtain the windowId and pass it through
|
||||
|
@ -139,7 +139,7 @@ loop.conversation = (function(mozL10n) {
|
||||
loop.store.StoreMixin.register({
|
||||
conversationAppStore: conversationAppStore,
|
||||
conversationStore: conversationStore,
|
||||
feedbackStore: feedbackStore,
|
||||
feedbackStore: feedbackStore
|
||||
});
|
||||
|
||||
// Obtain the windowId and pass it through
|
||||
|
@ -153,7 +153,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
showMenu: false,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -285,7 +285,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
var AcceptCallButton = React.createClass({displayName: "AcceptCallButton",
|
||||
|
||||
propTypes: {
|
||||
mode: React.PropTypes.object.isRequired,
|
||||
mode: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -761,7 +761,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
return this._renderViewFromCallType();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
@ -153,7 +153,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
showMenu: false,
|
||||
showMenu: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -285,7 +285,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
var AcceptCallButton = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
mode: React.PropTypes.object.isRequired,
|
||||
mode: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -761,7 +761,7 @@ loop.conversationViews = (function(mozL10n) {
|
||||
return this._renderViewFromCallType();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
window.OTProperties = {
|
||||
cdnURL: 'loop/',
|
||||
cdnURL: 'loop/'
|
||||
};
|
||||
window.OTProperties.assetURL = window.OTProperties.cdnURL + 'sdk-content/';
|
||||
window.OTProperties.configURL = window.OTProperties.assetURL + 'js/dynamic_config.min.js';
|
||||
|
@ -268,7 +268,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
React.createElement("a", {href: privacy_notice_url, target: "_blank"},
|
||||
mozL10n.get("legal_text_privacy")
|
||||
)
|
||||
),
|
||||
)
|
||||
});
|
||||
return (
|
||||
React.createElement("div", {id: "powered-by-wrapper"},
|
||||
@ -759,7 +759,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
userProfile: this.props.userProfile || this.props.mozLoop.userProfile,
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen"),
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen")
|
||||
};
|
||||
},
|
||||
|
||||
@ -772,7 +772,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
var firstErrorKey = Object.keys(this.props.mozLoop.errors)[0];
|
||||
return {
|
||||
type: firstErrorKey,
|
||||
error: this.props.mozLoop.errors[firstErrorKey],
|
||||
error: this.props.mozLoop.errors[firstErrorKey]
|
||||
};
|
||||
},
|
||||
|
||||
@ -785,7 +785,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
message: serviceError.error.friendlyMessage,
|
||||
details: serviceError.error.friendlyDetails,
|
||||
detailsButtonLabel: serviceError.error.friendlyDetailsButtonLabel,
|
||||
detailsButtonCallback: serviceError.error.friendlyDetailsButtonCallback,
|
||||
detailsButtonCallback: serviceError.error.friendlyDetailsButtonCallback
|
||||
});
|
||||
} else {
|
||||
this.props.notifications.remove(this.props.notifications.get("service-error"));
|
||||
@ -806,7 +806,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
_gettingStartedSeen: function() {
|
||||
this.setState({
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen"),
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen")
|
||||
});
|
||||
},
|
||||
|
||||
@ -959,7 +959,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
RoomList: RoomList,
|
||||
SettingsDropdown: SettingsDropdown,
|
||||
ToSView: ToSView,
|
||||
UserIdentity: UserIdentity,
|
||||
UserIdentity: UserIdentity
|
||||
};
|
||||
})(_, document.mozL10n);
|
||||
|
||||
|
@ -268,7 +268,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
<a href={privacy_notice_url} target="_blank">
|
||||
{mozL10n.get("legal_text_privacy")}
|
||||
</a>
|
||||
),
|
||||
)
|
||||
});
|
||||
return (
|
||||
<div id="powered-by-wrapper">
|
||||
@ -759,7 +759,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
getInitialState: function() {
|
||||
return {
|
||||
userProfile: this.props.userProfile || this.props.mozLoop.userProfile,
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen"),
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen")
|
||||
};
|
||||
},
|
||||
|
||||
@ -772,7 +772,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
var firstErrorKey = Object.keys(this.props.mozLoop.errors)[0];
|
||||
return {
|
||||
type: firstErrorKey,
|
||||
error: this.props.mozLoop.errors[firstErrorKey],
|
||||
error: this.props.mozLoop.errors[firstErrorKey]
|
||||
};
|
||||
},
|
||||
|
||||
@ -785,7 +785,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
message: serviceError.error.friendlyMessage,
|
||||
details: serviceError.error.friendlyDetails,
|
||||
detailsButtonLabel: serviceError.error.friendlyDetailsButtonLabel,
|
||||
detailsButtonCallback: serviceError.error.friendlyDetailsButtonCallback,
|
||||
detailsButtonCallback: serviceError.error.friendlyDetailsButtonCallback
|
||||
});
|
||||
} else {
|
||||
this.props.notifications.remove(this.props.notifications.get("service-error"));
|
||||
@ -806,7 +806,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
|
||||
_gettingStartedSeen: function() {
|
||||
this.setState({
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen"),
|
||||
gettingStartedSeen: this.props.mozLoop.getLoopPref("gettingStarted.seen")
|
||||
});
|
||||
},
|
||||
|
||||
@ -959,7 +959,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
RoomList: RoomList,
|
||||
SettingsDropdown: SettingsDropdown,
|
||||
ToSView: ToSView,
|
||||
UserIdentity: UserIdentity,
|
||||
UserIdentity: UserIdentity
|
||||
};
|
||||
})(_, document.mozL10n);
|
||||
|
||||
|
@ -117,7 +117,7 @@ loop.store = loop.store || {};
|
||||
error: null,
|
||||
pendingCreation: false,
|
||||
pendingInitialRetrieval: false,
|
||||
rooms: [],
|
||||
rooms: []
|
||||
};
|
||||
},
|
||||
|
||||
@ -258,7 +258,7 @@ loop.store = loop.store || {};
|
||||
createRoom: function(actionData) {
|
||||
this.setStoreState({
|
||||
pendingCreation: true,
|
||||
error: null,
|
||||
error: null
|
||||
});
|
||||
|
||||
var roomCreationData = {
|
||||
|
@ -129,7 +129,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
|
||||
mozL10n.get("share_panel_body", {
|
||||
brandShortname: mozL10n.get("brandShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname")
|
||||
})
|
||||
|
||||
),
|
||||
|
@ -129,7 +129,7 @@ loop.roomViews = (function(mozL10n) {
|
||||
{
|
||||
mozL10n.get("share_panel_body", {
|
||||
brandShortname: mozL10n.get("brandShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname")
|
||||
})
|
||||
}
|
||||
</div>
|
||||
|
@ -252,7 +252,7 @@ loop.shared.actions = (function() {
|
||||
// The localized template to use to name the new room
|
||||
// (eg. "Conversation {{conversationLabel}}").
|
||||
nameTemplate: String,
|
||||
roomOwner: String,
|
||||
roomOwner: String
|
||||
// See https://wiki.mozilla.org/Loop/Architecture/Context#Format_of_context.value
|
||||
// urls: Object - Optional
|
||||
}),
|
||||
|
@ -565,7 +565,7 @@ loop.store.ActiveRoomStore = (function() {
|
||||
constraints: {
|
||||
browserWindow: windowId,
|
||||
scrollWithPage: true
|
||||
},
|
||||
}
|
||||
};
|
||||
this._sdkDriver.startScreenShare(options);
|
||||
} else if (screenSharingState === SCREEN_SHARE_STATES.ACTIVE) {
|
||||
|
@ -186,7 +186,7 @@ loop.shared.mixins = (function() {
|
||||
|
||||
toggleDropdownMenu: function() {
|
||||
this[this.state.showMenu ? "hideDropdownMenu" : "showDropdownMenu"]();
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -517,7 +517,7 @@ loop.shared.mixins = (function() {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
publishVideo: options.publishVideo,
|
||||
showControls: false,
|
||||
showControls: false
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -363,7 +363,7 @@ loop.shared.models = (function(l10n) {
|
||||
this._signalEnd("session:peer-hungup", event);
|
||||
}
|
||||
this.endSession();
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
propTypes: {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
visible: React.PropTypes.bool.isRequired,
|
||||
state: React.PropTypes.string.isRequired,
|
||||
state: React.PropTypes.string.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
@ -199,7 +199,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
hangup: React.PropTypes.func.isRequired,
|
||||
publishStream: React.PropTypes.func.isRequired,
|
||||
hangupButtonLabel: React.PropTypes.string,
|
||||
enableHangup: React.PropTypes.bool,
|
||||
enableHangup: React.PropTypes.bool
|
||||
},
|
||||
|
||||
handleClickHangup: function() {
|
||||
@ -560,14 +560,14 @@ loop.shared.views = (function(_, l10n) {
|
||||
onClick: React.PropTypes.func.isRequired,
|
||||
disabled: React.PropTypes.bool,
|
||||
additionalClass: React.PropTypes.string,
|
||||
htmlId: React.PropTypes.string,
|
||||
htmlId: React.PropTypes.string
|
||||
},
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
disabled: false,
|
||||
additionalClass: "",
|
||||
htmlId: "",
|
||||
htmlId: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -596,7 +596,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
additionalClass: "",
|
||||
additionalClass: ""
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -88,7 +88,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
propTypes: {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
visible: React.PropTypes.bool.isRequired,
|
||||
state: React.PropTypes.string.isRequired,
|
||||
state: React.PropTypes.string.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
@ -199,7 +199,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
hangup: React.PropTypes.func.isRequired,
|
||||
publishStream: React.PropTypes.func.isRequired,
|
||||
hangupButtonLabel: React.PropTypes.string,
|
||||
enableHangup: React.PropTypes.bool,
|
||||
enableHangup: React.PropTypes.bool
|
||||
},
|
||||
|
||||
handleClickHangup: function() {
|
||||
@ -560,14 +560,14 @@ loop.shared.views = (function(_, l10n) {
|
||||
onClick: React.PropTypes.func.isRequired,
|
||||
disabled: React.PropTypes.bool,
|
||||
additionalClass: React.PropTypes.string,
|
||||
htmlId: React.PropTypes.string,
|
||||
htmlId: React.PropTypes.string
|
||||
},
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
disabled: false,
|
||||
additionalClass: "",
|
||||
htmlId: "",
|
||||
htmlId: ""
|
||||
};
|
||||
},
|
||||
|
||||
@ -596,7 +596,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
additionalClass: "",
|
||||
additionalClass: ""
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -462,7 +462,7 @@ this.GoogleImporter.prototype = {
|
||||
let addressNodes = entry.getElementsByTagNameNS(kNS_GD, "structuredPostalAddress");
|
||||
if (addressNodes.length) {
|
||||
contact.adr = [];
|
||||
for (let [,addressNode] of Iterator(addressNodes)) {
|
||||
for (let [, addressNode] of Iterator(addressNodes)) {
|
||||
let adr = extractFieldsFromNode(new Map([
|
||||
["countryName", "country"],
|
||||
["locality", "city"],
|
||||
@ -482,7 +482,7 @@ this.GoogleImporter.prototype = {
|
||||
let emailNodes = entry.getElementsByTagNameNS(kNS_GD, "email");
|
||||
if (emailNodes.length) {
|
||||
contact.email = [];
|
||||
for (let [,emailNode] of Iterator(emailNodes)) {
|
||||
for (let [, emailNode] of Iterator(emailNodes)) {
|
||||
contact.email.push({
|
||||
pref: (emailNode.getAttribute("primary") == "true"),
|
||||
type: [getFieldType(emailNode)],
|
||||
@ -495,7 +495,7 @@ this.GoogleImporter.prototype = {
|
||||
let phoneNodes = entry.getElementsByTagNameNS(kNS_GD, "phoneNumber");
|
||||
if (phoneNodes.length) {
|
||||
contact.tel = [];
|
||||
for (let [,phoneNode] of Iterator(phoneNodes)) {
|
||||
for (let [, phoneNode] of Iterator(phoneNodes)) {
|
||||
let phoneNumber = phoneNode.hasAttribute("uri") ?
|
||||
phoneNode.getAttribute("uri").replace("tel:", "") :
|
||||
phoneNode.textContent;
|
||||
@ -511,7 +511,7 @@ this.GoogleImporter.prototype = {
|
||||
if (orgNodes.length) {
|
||||
contact.org = [];
|
||||
contact.jobTitle = [];
|
||||
for (let [,orgNode] of Iterator(orgNodes)) {
|
||||
for (let [, orgNode] of Iterator(orgNodes)) {
|
||||
let orgElement = orgNode.getElementsByTagNameNS(kNS_GD, "orgName")[0];
|
||||
let titleElement = orgNode.getElementsByTagNameNS(kNS_GD, "orgTitle")[0];
|
||||
contact.org.push(orgElement ? orgElement.textContent : "");
|
||||
|
@ -94,7 +94,7 @@ CallProgressSocket.prototype = {
|
||||
let helloMsg = {
|
||||
messageType: "hello",
|
||||
callId: this._callId,
|
||||
auth: this._token,
|
||||
auth: this._token
|
||||
};
|
||||
try { // in case websocket has closed before this handler is run
|
||||
this._websocket.sendMsg(JSON.stringify(helloMsg));
|
||||
@ -182,7 +182,7 @@ CallProgressSocket.prototype = {
|
||||
event: "terminate",
|
||||
reason: "busy"
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -194,7 +194,7 @@ CallProgressSocket.prototype = {
|
||||
*/
|
||||
let LoopCallsInternal = {
|
||||
mocks: {
|
||||
webSocket: undefined,
|
||||
webSocket: undefined
|
||||
},
|
||||
|
||||
conversationInProgress: {},
|
||||
|
@ -207,7 +207,7 @@ PushSocket.prototype = {
|
||||
this._websocket.close(this._websocket.CLOSE_NORMAL);
|
||||
}
|
||||
catch (e) {}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ RetryManager.prototype = {
|
||||
clearTimeout(this._timeoutID);
|
||||
this._timeoutID = null;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -313,7 +313,7 @@ PingMonitor.prototype = {
|
||||
consoleLog.info("PushHandler: ping sent");
|
||||
this._pingTimerID = setTimeout(this._onTimeout, this._pingTimeout);
|
||||
this._pingFunc();
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -870,5 +870,5 @@ let MozLoopPushHandler = {
|
||||
this._pushSocket.send({messageType: "register",
|
||||
channelID: channelID});
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ const INVALID_AUTH_TOKEN = 110;
|
||||
|
||||
const LOOP_SESSION_TYPE = {
|
||||
GUEST: 1,
|
||||
FXA: 2,
|
||||
FXA: 2
|
||||
};
|
||||
|
||||
/***
|
||||
@ -26,7 +26,7 @@ const TWO_WAY_MEDIA_CONN_LENGTH = {
|
||||
SHORTER_THAN_10S: 0,
|
||||
BETWEEN_10S_AND_30S: 1,
|
||||
BETWEEN_30S_AND_5M: 2,
|
||||
MORE_THAN_5M: 3,
|
||||
MORE_THAN_5M: 3
|
||||
};
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let ConsoleAPI = Cu.import("resource://gre/modules/devtools/Console.jsm", {}).ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevel: Services.prefs.getCharPref(PREF_LOG_LEVEL).toLowerCase(),
|
||||
prefix: "Loop",
|
||||
prefix: "Loop"
|
||||
};
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
@ -159,7 +159,7 @@ let MozLoopServiceInternal = {
|
||||
pushURLs: new Map(),
|
||||
|
||||
mocks: {
|
||||
pushHandler: undefined,
|
||||
pushHandler: undefined
|
||||
},
|
||||
|
||||
/**
|
||||
@ -275,7 +275,7 @@ let MozLoopServiceInternal = {
|
||||
Cr.NS_ERROR_OFFLINE,
|
||||
Cr.NS_ERROR_PROXY_CONNECTION_REFUSED,
|
||||
Cr.NS_ERROR_UNKNOWN_HOST,
|
||||
Cr.NS_ERROR_UNKNOWN_PROXY_HOST,
|
||||
Cr.NS_ERROR_UNKNOWN_PROXY_HOST
|
||||
];
|
||||
|
||||
if (error.code === null && error.errno === null &&
|
||||
@ -765,7 +765,7 @@ let MozLoopServiceInternal = {
|
||||
|
||||
let ai = Services.appinfo;
|
||||
let uuid = uuidgen.generateUUID().toString();
|
||||
uuid = uuid.substr(1,uuid.length-2); // remove uuid curly braces
|
||||
uuid = uuid.substr(1, uuid.length-2); // remove uuid curly braces
|
||||
|
||||
let directory = OS.Path.join(OS.Constants.Path.profileDir,
|
||||
"saved-telemetry-pings");
|
||||
@ -964,7 +964,7 @@ let MozLoopServiceInternal = {
|
||||
|
||||
try {
|
||||
gFxAOAuthClient = new FxAccountsOAuthClient({
|
||||
parameters: parameters,
|
||||
parameters: parameters
|
||||
});
|
||||
} catch (ex) {
|
||||
gFxAOAuthClientPromise = null;
|
||||
@ -1020,7 +1020,7 @@ let MozLoopServiceInternal = {
|
||||
|
||||
let payload = {
|
||||
code: code,
|
||||
state: state,
|
||||
state: state
|
||||
};
|
||||
return this.hawkRequestInternal(LOOP_SESSION_TYPE.FXA, "/fxa-oauth/token", "POST", payload).then(response => {
|
||||
return JSON.parse(response.body);
|
||||
@ -1052,7 +1052,7 @@ let MozLoopServiceInternal = {
|
||||
_fxAOAuthError: function(deferred, err) {
|
||||
gFxAOAuthClientPromise = null;
|
||||
deferred.reject(err);
|
||||
},
|
||||
}
|
||||
};
|
||||
Object.freeze(MozLoopServiceInternal);
|
||||
|
||||
@ -1079,7 +1079,7 @@ this.MozLoopService = {
|
||||
return {
|
||||
callsFxA: "25389583-921f-4169-a426-a4673658944b",
|
||||
roomsFxA: "6add272a-d316-477c-8335-f00f73dfde71",
|
||||
roomsGuest: "19d3f799-a8f3-4328-9822-b7cd02765832",
|
||||
roomsGuest: "19d3f799-a8f3-4328-9822-b7cd02765832"
|
||||
};
|
||||
},
|
||||
|
||||
@ -1621,7 +1621,7 @@ this.MozLoopService = {
|
||||
}
|
||||
|
||||
let url = this.getTourURL("resume-with-conversation", {
|
||||
incomingConversation: aIncomingConversationState,
|
||||
incomingConversation: aIncomingConversationState
|
||||
});
|
||||
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
@ -1632,14 +1632,14 @@ this.MozLoopService = {
|
||||
// already open so we ignore the fragment and query string.
|
||||
let hadExistingTab = win.switchToTabHavingURI(url, true, {
|
||||
ignoreFragment: true,
|
||||
ignoreQueryString: true,
|
||||
ignoreQueryString: true
|
||||
});
|
||||
|
||||
// If the tab was already open, send an event instead of using the query
|
||||
// parameter above (that we don't replace on existing tabs to avoid a reload).
|
||||
if (hadExistingTab) {
|
||||
UITour.notify("Loop:IncomingConversation", {
|
||||
conversationOpen: aIncomingConversationState === "open",
|
||||
conversationOpen: aIncomingConversationState === "open"
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -1655,7 +1655,7 @@ this.MozLoopService = {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.switchToTabHavingURI(url, true, {
|
||||
ignoreFragment: true,
|
||||
replaceQueryString: true,
|
||||
replaceQueryString: true
|
||||
});
|
||||
} catch (ex) {
|
||||
log.error("Error opening Getting Started tour", ex);
|
||||
|
@ -124,7 +124,7 @@ loop.standaloneMedia = (function() {
|
||||
localStream: null,
|
||||
pending: false,
|
||||
errorCallbacks: [],
|
||||
successCallbacks: [],
|
||||
successCallbacks: []
|
||||
};
|
||||
}
|
||||
};
|
||||
@ -145,6 +145,6 @@ loop.standaloneMedia = (function() {
|
||||
_MultiplexGum: _MultiplexGum,
|
||||
setSingleton: function(singleton) {
|
||||
singletonMultiplexGum = singleton;
|
||||
},
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
@ -128,7 +128,7 @@ loop.StandaloneClient = (function($) {
|
||||
}.bind(this));
|
||||
|
||||
req.fail(this._failureHandler.bind(this, cb));
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
return StandaloneClient;
|
||||
|
@ -205,7 +205,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
React.createElement("a", {href: loop.config.privacyWebsiteUrl, target: "_blank"},
|
||||
mozL10n.get("privacy_notice_link_text")
|
||||
)
|
||||
),
|
||||
)
|
||||
});
|
||||
},
|
||||
|
||||
@ -576,7 +576,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
var screenShareStreamClasses = React.addons.classSet({
|
||||
"screen": true,
|
||||
"focus-stream": this.state.receivingScreenShare,
|
||||
hide: !this.state.receivingScreenShare,
|
||||
hide: !this.state.receivingScreenShare
|
||||
});
|
||||
|
||||
return (
|
||||
|
@ -205,7 +205,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
<a href={loop.config.privacyWebsiteUrl} target="_blank">
|
||||
{mozL10n.get("privacy_notice_link_text")}
|
||||
</a>
|
||||
),
|
||||
)
|
||||
});
|
||||
},
|
||||
|
||||
@ -576,7 +576,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
var screenShareStreamClasses = React.addons.classSet({
|
||||
"screen": true,
|
||||
"focus-stream": this.state.receivingScreenShare,
|
||||
hide: !this.state.receivingScreenShare,
|
||||
hide: !this.state.receivingScreenShare
|
||||
});
|
||||
|
||||
return (
|
||||
|
@ -858,7 +858,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
this._websocket = new loop.CallConnectionWebSocket({
|
||||
url: this.props.conversation.get("progressURL"),
|
||||
websocketToken: this.props.conversation.get("websocketToken"),
|
||||
callId: this.props.conversation.get("callId"),
|
||||
callId: this.props.conversation.get("callId")
|
||||
});
|
||||
this._websocket.promiseConnect().then(function() {
|
||||
}.bind(this), function() {
|
||||
@ -930,7 +930,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
if (this.state.callStatus !== "failure") {
|
||||
this.setState({callStatus: "end"});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -858,7 +858,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
this._websocket = new loop.CallConnectionWebSocket({
|
||||
url: this.props.conversation.get("progressURL"),
|
||||
websocketToken: this.props.conversation.get("websocketToken"),
|
||||
callId: this.props.conversation.get("callId"),
|
||||
callId: this.props.conversation.get("callId")
|
||||
});
|
||||
this._websocket.promiseConnect().then(function() {
|
||||
}.bind(this), function() {
|
||||
@ -930,7 +930,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
if (this.state.callStatus !== "failure") {
|
||||
this.setState({callStatus: "end"});
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ describe("loop.contacts", function() {
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
},{
|
||||
}, {
|
||||
id: 2,
|
||||
_guid: 2,
|
||||
name: ["Bob Banana"],
|
||||
@ -118,7 +118,7 @@ describe("loop.contacts", function() {
|
||||
};
|
||||
|
||||
fakeWindow = {
|
||||
close: sandbox.stub(),
|
||||
close: sandbox.stub()
|
||||
};
|
||||
loop.shared.mixins.setRootObject(fakeWindow);
|
||||
|
||||
|
@ -162,7 +162,7 @@ describe("loop.conversation", function() {
|
||||
}});
|
||||
|
||||
roomStore = new loop.store.RoomStore(dispatcher, {
|
||||
mozLoop: navigator.mozLoop,
|
||||
mozLoop: navigator.mozLoop
|
||||
});
|
||||
conversationAppStore = new loop.store.ConversationAppStore({
|
||||
dispatcher: dispatcher,
|
||||
|
@ -801,7 +801,7 @@ describe("loop.panel", function() {
|
||||
location: "http://invalid.com",
|
||||
description: "fakeSite",
|
||||
thumbnail: "fakeimage.png"
|
||||
}],
|
||||
}]
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -201,7 +201,7 @@ describe("loop.store.RoomStore", function () {
|
||||
rooms: [{
|
||||
decryptedContext: {
|
||||
roomName: "RoomWord 99"
|
||||
},
|
||||
}
|
||||
}, {
|
||||
decryptedContext: {
|
||||
roomName: "RoomWord 98"
|
||||
@ -269,7 +269,7 @@ describe("loop.store.RoomStore", function () {
|
||||
location: "http://invalid.com",
|
||||
description: "fakeSite",
|
||||
thumbnail: "fakeimage.png"
|
||||
}],
|
||||
}]
|
||||
},
|
||||
roomOwner: fakeOwner,
|
||||
maxSize: store.maxRoomCreationSize
|
||||
|
@ -81,7 +81,7 @@ let vcards = [
|
||||
"EMAIL:anyone@example.com\n" +
|
||||
"REV:2011-07-12T14:43:20Z\n" +
|
||||
"UID:pid8\n" +
|
||||
"END:VCARD\n",
|
||||
"END:VCARD\n"
|
||||
];
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ add_task(function* test_CardDavImport() {
|
||||
error = yield new Promise ((resolve, reject) => {
|
||||
info("Initiating import");
|
||||
importer.startImport({
|
||||
"host": "example.com",
|
||||
"host": "example.com"
|
||||
}, (err, result) => { err ? resolve(err) : reject(new Error("Should have failed")); }, mockDb);
|
||||
});
|
||||
Assert.equal(error.message, "No authentication specified", "Missing parameters should generate error");
|
||||
|
@ -26,7 +26,7 @@ const kContacts = [{
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
},{
|
||||
}, {
|
||||
id: 2,
|
||||
name: ["Bob Banana"],
|
||||
email: [{
|
||||
|
@ -60,7 +60,7 @@ add_task(function* checkOAuthParams() {
|
||||
content_uri: BASE_URL + "/content",
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
state: "state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
let client = yield MozLoopServiceInternal.promiseFxAOAuthClient();
|
||||
@ -108,7 +108,7 @@ add_task(function* params_no_hawk_session() {
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
test_error: "params_no_hawk",
|
||||
test_error: "params_no_hawk"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -153,7 +153,7 @@ add_task(function* invalidState() {
|
||||
content_uri: BASE_URL + "/content",
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "invalid_state",
|
||||
state: "invalid_state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
let loginPromise = MozLoopService.logInToFxA();
|
||||
@ -180,7 +180,7 @@ add_task(function* basicRegistration() {
|
||||
content_uri: BASE_URL + "/content",
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
state: "state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
yield resetFxA();
|
||||
@ -201,7 +201,7 @@ add_task(function* registrationWithInvalidState() {
|
||||
content_uri: BASE_URL + "/content",
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "invalid_state",
|
||||
state: "invalid_state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -228,7 +228,7 @@ add_task(function* registrationWith401() {
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
test_error: "token_401",
|
||||
test_error: "token_401"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -277,7 +277,7 @@ add_task(function* basicAuthorizationAndRegistration() {
|
||||
content_uri: BASE_URL + "/content",
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
state: "state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -340,7 +340,7 @@ add_task(function* loginWithParams401() {
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
test_error: "params_401",
|
||||
test_error: "params_401"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
yield MozLoopService.promiseRegisteredWithServers();
|
||||
@ -402,7 +402,7 @@ add_task(function* loginWithRegistration401() {
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
test_error: "token_401",
|
||||
test_error: "token_401"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -432,7 +432,7 @@ add_task(function* openFxASettings() {
|
||||
oauth_uri: BASE_URL + "/oauth",
|
||||
profile_uri: BASE_URL + "/profile",
|
||||
state: "state",
|
||||
test_error: "token_401",
|
||||
test_error: "token_401"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -448,7 +448,7 @@ add_task(function* openFxASettings() {
|
||||
is(aBrowser.currentURI.spec, Services.io.newURI("/settings", null, contentURI).spec,
|
||||
"Check settings tab URL");
|
||||
resolve();
|
||||
},
|
||||
}
|
||||
};
|
||||
gBrowser.addTabsProgressListener(progressListener);
|
||||
|
||||
|
@ -19,7 +19,7 @@ add_task(function* required_setup_params() {
|
||||
content_uri: "https://example.com/content/",
|
||||
oauth_uri: "https://example.com/oauth/",
|
||||
profile_uri: "https://example.com/profile/",
|
||||
state: "my_state",
|
||||
state: "my_state"
|
||||
};
|
||||
let request = yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
is(request.status, 200, "Check /setup_params status");
|
||||
@ -38,7 +38,7 @@ add_task(function* optional_setup_params() {
|
||||
oauth_uri: "https://example.com/oauth/",
|
||||
profile_uri: "https://example.com/profile/",
|
||||
scope: "profile",
|
||||
state: "my_state",
|
||||
state: "my_state"
|
||||
};
|
||||
let request = yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
is(request.status, 200, "Check /setup_params status");
|
||||
@ -63,7 +63,7 @@ add_task(function* token_request() {
|
||||
content_uri: "https://example.com/content/",
|
||||
oauth_uri: "https://example.com/oauth/",
|
||||
profile_uri: "https://example.com/profile/",
|
||||
state: "my_state",
|
||||
state: "my_state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
|
||||
@ -80,7 +80,7 @@ add_task(function* token_request_invalid_state() {
|
||||
content_uri: "https://example.com/content/",
|
||||
oauth_uri: "https://example.com/oauth/",
|
||||
profile_uri: "https://example.com/profile/",
|
||||
state: "my_invalid_state",
|
||||
state: "my_invalid_state"
|
||||
};
|
||||
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||
let request = yield promiseToken("my_code", "my_state");
|
||||
@ -120,7 +120,7 @@ function promiseToken(code, state) {
|
||||
xhr.addEventListener("error", reject);
|
||||
let payload = {
|
||||
code: code,
|
||||
state: state,
|
||||
state: state
|
||||
};
|
||||
xhr.send(JSON.stringify(payload, null, 4));
|
||||
});
|
||||
|
@ -756,7 +756,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
|
||||
store.setupWindowData(new sharedActions.SetupWindowData({
|
||||
windowId: "42",
|
||||
type: "room",
|
||||
type: "room"
|
||||
}));
|
||||
|
||||
store.joinedRoom(actionData);
|
||||
|
@ -1056,7 +1056,7 @@ describe("loop.store.ConversationStore", function () {
|
||||
|
||||
store._websocket.trigger("progress", {
|
||||
state: WS_STATES.TERMINATED,
|
||||
reason: WEBSOCKET_REASONS.REJECT,
|
||||
reason: WEBSOCKET_REASONS.REJECT
|
||||
});
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
|
@ -188,7 +188,7 @@ describe("loop.shared.models", function() {
|
||||
model.set({
|
||||
windowId: "28",
|
||||
sessionId: "321456",
|
||||
callId: "142536",
|
||||
callId: "142536"
|
||||
});
|
||||
model.startSession();
|
||||
|
||||
|
@ -292,7 +292,7 @@ describe("loop.standaloneMedia._MultiplexGum", function() {
|
||||
localStream: null,
|
||||
pending: false,
|
||||
errorCallbacks: [],
|
||||
successCallbacks: [],
|
||||
successCallbacks: []
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -214,7 +214,7 @@ MockWebSocketChannel.prototype = {
|
||||
|
||||
serverClose: function (err) {
|
||||
this.listener.onServerClose(this.context, err || -1);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const extend = function(target, source) {
|
||||
|
@ -161,7 +161,7 @@ const kRoomUpdates = {
|
||||
|
||||
const kCreateRoomProps = {
|
||||
decryptedContext: {
|
||||
roomName: "UX Discussion",
|
||||
roomName: "UX Discussion"
|
||||
},
|
||||
roomOwner: "Alexis",
|
||||
maxSize: 2
|
||||
@ -428,7 +428,7 @@ add_task(function* test_openRoom() {
|
||||
// Test if the rooms cache is refreshed after FxA signin or signout.
|
||||
add_task(function* test_refresh() {
|
||||
// XXX Temporarily whilst FxA encryption isn't handled (bug 1153788).
|
||||
Array.prototype.push.apply(gExpectedAdds, [...kExpectedRooms.values()].slice(1,3));
|
||||
Array.prototype.push.apply(gExpectedAdds, [...kExpectedRooms.values()].slice(1, 3));
|
||||
gExpectedRefresh = true;
|
||||
|
||||
// Make the switch.
|
||||
|
@ -56,7 +56,7 @@ const kExpectedRooms = new Map([
|
||||
alg: "AES-GCM"
|
||||
},
|
||||
decryptedContext: {
|
||||
roomName: "Loopy Discussion",
|
||||
roomName: "Loopy Discussion"
|
||||
},
|
||||
roomKey: "h2H8Sa9QxLCTTiXNmJVtRA",
|
||||
roomToken: "QzBbvGmIZWU",
|
||||
@ -66,7 +66,7 @@ const kExpectedRooms = new Map([
|
||||
|
||||
const kCreateRoomProps = {
|
||||
decryptedContext: {
|
||||
roomName: "Say Hello",
|
||||
roomName: "Say Hello"
|
||||
},
|
||||
roomOwner: "Gavin",
|
||||
maxSize: 2
|
||||
|
@ -39,7 +39,7 @@ const kRoomsResponses = new Map([
|
||||
roomUrl: "http://localhost:3000/rooms/QzBbvGmIZWU",
|
||||
maxSize: 2,
|
||||
ctime: 140551741
|
||||
}],
|
||||
}]
|
||||
]);
|
||||
|
||||
let gRoomsAdded = [];
|
||||
|
@ -54,7 +54,11 @@ function run_test() {
|
||||
|
||||
// Setup fake login state so we get FxA requests.
|
||||
const MozLoopServiceInternal = Cu.import("resource:///modules/loop/MozLoopService.jsm", {}).MozLoopServiceInternal;
|
||||
MozLoopServiceInternal.fxAOAuthTokenData = {token_type:"bearer",access_token:"1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1752",scope:"profile"};
|
||||
MozLoopServiceInternal.fxAOAuthTokenData = {
|
||||
token_type:"bearer",
|
||||
access_token:"1bad3e44b12f77a88fe09f016f6a37c42e40f974bc7a8b432bb0d2f0e37e1752",
|
||||
scope:"profile"
|
||||
};
|
||||
MozLoopServiceInternal.fxAOAuthProfile = {email: "test@example.com", uid: "abcd1234"};
|
||||
|
||||
let mockWebSocket = new MockWebSocketChannel();
|
||||
@ -83,7 +87,7 @@ function run_test() {
|
||||
progressURL: "wss://localhost:5000/websocket"}]},
|
||||
{calls: [{callId: secondCallId,
|
||||
websocketToken: "1deadbeef1",
|
||||
progressURL: "wss://localhost:5000/websocket"}]},
|
||||
progressURL: "wss://localhost:5000/websocket"}]}
|
||||
];
|
||||
|
||||
loopServer.registerPathHandler("/registration", (request, response) => {
|
||||
|
@ -23,7 +23,7 @@ function errorRequestHandler(request, response) {
|
||||
code: parseInt(responseCode),
|
||||
errno: INVALID_AUTH_TOKEN,
|
||||
error: "INVALID_AUTH_TOKEN",
|
||||
message: "INVALID_AUTH_TOKEN",
|
||||
message: "INVALID_AUTH_TOKEN"
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ add_task(function* test_initialize_with_invalid_fxa_token() {
|
||||
code: 401,
|
||||
errno: 110,
|
||||
error: "Unauthorized",
|
||||
message: "Unknown credentials",
|
||||
message: "Unknown credentials"
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -21,7 +21,7 @@ add_test(function test_registration_invalid_token() {
|
||||
code: 401,
|
||||
errno: 110,
|
||||
error: "Unauthorized",
|
||||
message: "Unknown credentials",
|
||||
message: "Unknown credentials"
|
||||
}));
|
||||
} else {
|
||||
// We didn't have an authorization header, so check the pref has been cleared.
|
||||
|
@ -38,7 +38,7 @@ var fakeRooms = [
|
||||
{
|
||||
"roomToken": "3jKS_Els9IU",
|
||||
"decryptedContext": {
|
||||
"roomName": "UX Discussion",
|
||||
"roomName": "UX Discussion"
|
||||
},
|
||||
"roomUrl": "http://localhost:3000/rooms/3jKS_Els9IU",
|
||||
"roomOwner": "Alexis",
|
||||
@ -71,7 +71,7 @@ var fakeContacts = [{
|
||||
category: ["google"],
|
||||
published: 1406798311748,
|
||||
updated: 1406798311748
|
||||
},{
|
||||
}, {
|
||||
id: 2,
|
||||
_guid: 2,
|
||||
name: ["Bob Banana"],
|
||||
|
@ -145,7 +145,7 @@
|
||||
level: "error",
|
||||
message: "Could Not Authenticate",
|
||||
details: "Did you change your password?",
|
||||
detailsButtonLabel: "Retry",
|
||||
detailsButtonLabel: "Retry"
|
||||
});
|
||||
|
||||
var SVGIcon = React.createClass({displayName: "SVGIcon",
|
||||
|
@ -145,7 +145,7 @@
|
||||
level: "error",
|
||||
message: "Could Not Authenticate",
|
||||
details: "Did you change your password?",
|
||||
detailsButtonLabel: "Retry",
|
||||
detailsButtonLabel: "Retry"
|
||||
});
|
||||
|
||||
var SVGIcon = React.createClass({
|
||||
|
@ -191,6 +191,7 @@ this.UITour = {
|
||||
return loopBrowser.contentDocument.querySelector(".signin-link");
|
||||
},
|
||||
}],
|
||||
["pocket", {query: "#pocket-button"}],
|
||||
["privateWindow", {query: "#privatebrowsing-button"}],
|
||||
["quit", {query: "#PanelUI-quit"}],
|
||||
["readerMode-urlBar", {query: "#reader-mode-button"}],
|
||||
|
@ -11,6 +11,26 @@ Components.utils.import("resource:///modules/UITour.jsm");
|
||||
|
||||
let hasWebIDE = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
|
||||
|
||||
let hasPocket = false;
|
||||
if (Services.prefs.getBoolPref("browser.pocket.enabled")) {
|
||||
let isEnabledForLocale = true;
|
||||
if (Services.prefs.getBoolPref("browser.pocket.useLocaleList")) {
|
||||
let chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry);
|
||||
let browserLocale = chromeRegistry.getSelectedLocale("browser");
|
||||
let enabledLocales = [];
|
||||
try {
|
||||
enabledLocales = Services.prefs.getCharPref("browser.pocket.enabledLocales").split(' ');
|
||||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
isEnabledForLocale = enabledLocales.indexOf(browserLocale) != -1;
|
||||
}
|
||||
if (isEnabledForLocale) {
|
||||
hasPocket = true;
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(2);
|
||||
UITourTest();
|
||||
@ -37,6 +57,7 @@ let tests = [
|
||||
"home",
|
||||
"loop",
|
||||
"devtools",
|
||||
...(hasPocket ? ["pocket"] : []),
|
||||
"privateWindow",
|
||||
"quit",
|
||||
"readerMode-urlBar",
|
||||
@ -68,6 +89,7 @@ let tests = [
|
||||
"loop",
|
||||
"devtools",
|
||||
"home",
|
||||
...(hasPocket ? ["pocket"] : []),
|
||||
"privateWindow",
|
||||
"quit",
|
||||
"readerMode-urlBar",
|
||||
@ -104,6 +126,7 @@ let tests = [
|
||||
"home",
|
||||
"loop",
|
||||
"devtools",
|
||||
...(hasPocket ? ["pocket"] : []),
|
||||
"privateWindow",
|
||||
"quit",
|
||||
"readerMode-urlBar",
|
||||
|
@ -2,8 +2,4 @@
|
||||
# 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/.
|
||||
|
||||
EXTRA_JS_MODULES.devtools.commandline += [
|
||||
'commands-index.js'
|
||||
]
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||
|
@ -23,7 +23,7 @@ function* spawnTest() {
|
||||
const { createSystem } = require("gcli/system");
|
||||
const system = createSystem({ location: "server" });
|
||||
|
||||
const gcliInit = require("devtools/commandline/commands-index");
|
||||
const gcliInit = require("gcli/commands/index");
|
||||
gcliInit.addAllItemsByModule(system);
|
||||
yield system.load();
|
||||
|
||||
|
@ -70,7 +70,7 @@ XPCOMUtils.defineLazyGetter(this, "is64Bit", () => {
|
||||
// White-list buttons that can be toggled to prevent adding prefs for
|
||||
// addons that have manually inserted toolbarbuttons into DOM.
|
||||
// (By default, supported target is only local tab)
|
||||
const ToolboxButtons = [
|
||||
const ToolboxButtons = exports.ToolboxButtons = [
|
||||
{ id: "command-button-pick",
|
||||
isTargetSupported: target =>
|
||||
target.getTrait("highlightable")
|
||||
@ -83,7 +83,8 @@ const ToolboxButtons = [
|
||||
isTargetSupported: target => !target.isAddon },
|
||||
{ id: "command-button-responsive" },
|
||||
{ id: "command-button-paintflashing" },
|
||||
{ id: "command-button-tilt" },
|
||||
{ id: "command-button-tilt",
|
||||
commands: "devtools/tilt/tilt-commands" },
|
||||
{ id: "command-button-scratchpad" },
|
||||
{ id: "command-button-eyedropper" },
|
||||
{ id: "command-button-screenshot" },
|
||||
@ -717,10 +718,13 @@ Toolbox.prototype = {
|
||||
this._buildPickerButton();
|
||||
}
|
||||
|
||||
// Set the visibility of the built in buttons before adding more buttons
|
||||
// so they are shown before calling into the GCLI actor.
|
||||
this.setToolboxButtonsVisibility();
|
||||
|
||||
// Old servers don't have a GCLI Actor, so just return
|
||||
if (!this.target.hasActor("gcli")) {
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
const options = {
|
||||
environment: CommandUtils.createEnvironment(this, '_target')
|
||||
};
|
||||
|
@ -117,7 +117,6 @@ browser.jar:
|
||||
content/browser/devtools/commandline.css (commandline/commandline.css)
|
||||
content/browser/devtools/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
|
||||
content/browser/devtools/commandlinetooltip.xhtml (commandline/commandlinetooltip.xhtml)
|
||||
content/browser/devtools/commandline/commands-index.js (commandline/commands-index.js)
|
||||
* content/browser/devtools/framework/toolbox-window.xul (framework/toolbox-window.xul)
|
||||
content/browser/devtools/framework/toolbox-options.xul (framework/toolbox-options.xul)
|
||||
content/browser/devtools/framework/toolbox-options.js (framework/toolbox-options.js)
|
||||
|
@ -174,7 +174,7 @@
|
||||
</hbox>
|
||||
<deck id="details-pane" flex="1">
|
||||
<hbox id="waterfall-view" flex="1">
|
||||
<vbox id="waterfall-breakdown" flex="1" />
|
||||
<vbox id="waterfall-breakdown" flex="1" class="devtools-main-content" />
|
||||
<splitter class="devtools-side-splitter"/>
|
||||
<vbox id="waterfall-details"
|
||||
class="theme-sidebar"
|
||||
|
@ -41,7 +41,7 @@ const Telemetry = require("devtools/shared/telemetry");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gcliInit", function() {
|
||||
try {
|
||||
return require("devtools/commandline/commands-index");
|
||||
return require("gcli/commands/index");
|
||||
}
|
||||
catch (ex) {
|
||||
console.log(ex);
|
||||
|
@ -61,6 +61,8 @@ EXTRA_JS_MODULES.devtools.shared += [
|
||||
'theme-switching.js',
|
||||
'theme.js',
|
||||
'undo.js',
|
||||
'worker-helper.js',
|
||||
'worker.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.devtools.shared.widgets += [
|
||||
|
@ -25,6 +25,9 @@ support-files =
|
||||
[browser_cubic-bezier-04.js]
|
||||
[browser_cubic-bezier-05.js]
|
||||
[browser_cubic-bezier-06.js]
|
||||
[browser_devtools-worker-01.js]
|
||||
[browser_devtools-worker-02.js]
|
||||
[browser_devtools-worker-03.js]
|
||||
[browser_filter-editor-01.js]
|
||||
[browser_filter-editor-02.js]
|
||||
[browser_filter-editor-03.js]
|
||||
|
44
browser/devtools/shared/test/browser_devtools-worker-01.js
Normal file
44
browser/devtools/shared/test/browser_devtools-worker-01.js
Normal file
@ -0,0 +1,44 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that the devtools/shared/worker communicates properly
|
||||
// as both CommonJS module and as a JSM.
|
||||
|
||||
const WORKER_URL = "resource:///modules/devtools/GraphsWorker.js";
|
||||
|
||||
const count = 100000;
|
||||
const WORKER_DATA = (function () {
|
||||
let timestamps = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
timestamps.push(i);
|
||||
}
|
||||
return timestamps;
|
||||
})();
|
||||
const INTERVAL = 100;
|
||||
const DURATION = 1000;
|
||||
|
||||
add_task(function*() {
|
||||
// Test both CJS and JSM versions
|
||||
yield testWorker("JSM", () => Cu.import("resource:///modules/devtools/shared/worker.js", {}));
|
||||
yield testWorker("CommonJS", () => devtools.require("devtools/shared/worker"));
|
||||
});
|
||||
|
||||
function *testWorker (context, workerFactory) {
|
||||
let { DevToolsWorker, workerify } = workerFactory();
|
||||
let worker = new DevToolsWorker(WORKER_URL);
|
||||
let results = yield worker.performTask("plotTimestampsGraph", {
|
||||
timestamps: WORKER_DATA,
|
||||
interval: INTERVAL,
|
||||
duration: DURATION
|
||||
});
|
||||
|
||||
ok(results.plottedData.length,
|
||||
`worker should have returned an object with array properties in ${context}`);
|
||||
|
||||
let fn = workerify(function (x) { return x * x });
|
||||
is((yield fn(5)), 25, `workerify works in ${context}`);
|
||||
fn.destroy();
|
||||
|
||||
|
||||
worker.destroy();
|
||||
}
|
45
browser/devtools/shared/test/browser_devtools-worker-02.js
Normal file
45
browser/devtools/shared/test/browser_devtools-worker-02.js
Normal file
@ -0,0 +1,45 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests errors are handled properly by the DevToolsWorker.
|
||||
|
||||
const { DevToolsWorker } = devtools.require("devtools/shared/worker");
|
||||
const WORKER_URL = "resource:///modules/devtools/GraphsWorker.js";
|
||||
|
||||
add_task(function*() {
|
||||
try {
|
||||
let workerNotFound = new DevToolsWorker("resource://i/dont/exist.js");
|
||||
ok(false, "Creating a DevToolsWorker with an invalid URL throws");
|
||||
} catch (e) {
|
||||
ok(true, "Creating a DevToolsWorker with an invalid URL throws");
|
||||
}
|
||||
|
||||
let worker = new DevToolsWorker(WORKER_URL);
|
||||
try {
|
||||
// plotTimestampsGraph requires timestamp, interval an duration props on the object
|
||||
// passed in so there should be an error thrown in the worker
|
||||
let results = yield worker.performTask("plotTimestampsGraph", {});
|
||||
ok(false, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
|
||||
} catch (e) {
|
||||
ok(true, "DevToolsWorker returns a rejected promise when an error occurs in the worker");
|
||||
}
|
||||
|
||||
try {
|
||||
let results = yield worker.performTask("not a real task");
|
||||
ok(false, "DevToolsWorker returns a rejected promise when task does not exist");
|
||||
} catch (e) {
|
||||
ok(true, "DevToolsWorker returns a rejected promise when task does not exist");
|
||||
}
|
||||
|
||||
worker.destroy();
|
||||
try {
|
||||
let results = yield worker.performTask("plotTimestampsGraph", {
|
||||
timestamps: [0,1,2,3,4,5,6,7,8,9],
|
||||
interval: 1,
|
||||
duration: 1
|
||||
});
|
||||
ok(false, "DevToolsWorker rejects when performing a task on a destroyed worker");
|
||||
} catch (e) {
|
||||
ok(true, "DevToolsWorker rejects when performing a task on a destroyed worker");
|
||||
};
|
||||
});
|
52
browser/devtools/shared/test/browser_devtools-worker-03.js
Normal file
52
browser/devtools/shared/test/browser_devtools-worker-03.js
Normal file
@ -0,0 +1,52 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that the devtools/shared/worker can handle:
|
||||
// returned primitives (or promise or Error)
|
||||
//
|
||||
// And tests `workerify` by doing so.
|
||||
|
||||
const { DevToolsWorker, workerify } = devtools.require("devtools/shared/worker");
|
||||
function square (x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
function squarePromise (x) {
|
||||
return new Promise((resolve) => resolve(x*x));
|
||||
}
|
||||
|
||||
function squareError (x) {
|
||||
return new Error("Nope");
|
||||
}
|
||||
|
||||
function squarePromiseReject (x) {
|
||||
return new Promise((_, reject) => reject("Nope"));
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
let fn = workerify(square);
|
||||
is((yield fn(5)), 25, "return primitives successful");
|
||||
fn.destroy();
|
||||
|
||||
fn = workerify(squarePromise);
|
||||
is((yield fn(5)), 25, "promise primitives successful");
|
||||
fn.destroy();
|
||||
|
||||
fn = workerify(squareError);
|
||||
try {
|
||||
yield fn(5);
|
||||
ok(false, "return error should reject");
|
||||
} catch (e) {
|
||||
ok(true, "return error should reject");
|
||||
}
|
||||
fn.destroy();
|
||||
|
||||
fn = workerify(squarePromiseReject);
|
||||
try {
|
||||
yield fn(5);
|
||||
ok(false, "returned rejected promise rejects");
|
||||
} catch (e) {
|
||||
ok(true, "returned rejected promise rejects");
|
||||
}
|
||||
fn.destroy();
|
||||
});
|
@ -8,6 +8,7 @@ let {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
|
||||
let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
const {DOMHelpers} = Cu.import("resource:///modules/devtools/DOMHelpers.jsm", {});
|
||||
const {Hosts} = require("devtools/framework/toolbox-hosts");
|
||||
const {defer} = require("sdk/core/promise");
|
||||
|
||||
gDevTools.testing = true;
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
@ -261,5 +262,3 @@ function waitUntil(predicate, interval = 10) {
|
||||
}, interval);
|
||||
});
|
||||
}
|
||||
|
||||
// EventUtils just doesn't work!
|
||||
|
@ -9,6 +9,7 @@ Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
|
||||
const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
|
||||
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js", {});
|
||||
const {DevToolsWorker} = Cu.import("resource:///modules/devtools/shared/worker.js", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = [
|
||||
"GraphCursor",
|
||||
@ -2148,40 +2149,14 @@ this.CanvasGraphUtils = {
|
||||
*
|
||||
* @param string task
|
||||
* The task name. Currently supported: "plotTimestampsGraph".
|
||||
* @param any args
|
||||
* @param any data
|
||||
* Extra arguments to pass to the worker.
|
||||
* @param array transferrable [optional]
|
||||
* A list of transferrable objects, if any.
|
||||
* @return object
|
||||
* A promise that is resolved once the worker finishes the task.
|
||||
*/
|
||||
_performTaskInWorker: function(task, args, transferrable) {
|
||||
let worker = this._graphUtilsWorker || new ChromeWorker(WORKER_URL);
|
||||
let id = this._graphUtilsTaskId++;
|
||||
worker.postMessage({ task, id, args }, transferrable);
|
||||
return this._waitForWorkerResponse(worker, id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Waits for the specified worker to finish a task.
|
||||
*
|
||||
* @param ChromeWorker worker
|
||||
* The worker for which to add a message listener.
|
||||
* @param number id
|
||||
* The worker task id.
|
||||
*/
|
||||
_waitForWorkerResponse: function(worker, id) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
worker.addEventListener("message", function listener({ data }) {
|
||||
if (data.id != id) {
|
||||
return;
|
||||
}
|
||||
worker.removeEventListener("message", listener);
|
||||
deferred.resolve(data);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
_performTaskInWorker: function(task, data) {
|
||||
let worker = this._graphUtilsWorker || new DevToolsWorker(WORKER_URL);
|
||||
return worker.performTask(task, data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3,18 +3,11 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
self.onmessage = e => {
|
||||
const { id, task, args } = e.data;
|
||||
|
||||
switch (task) {
|
||||
case "plotTimestampsGraph":
|
||||
plotTimestampsGraph(id, args);
|
||||
break;
|
||||
default:
|
||||
self.postMessage({ id, error: e.message + "\n" + e.stack });
|
||||
break;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Import `createTask` to communicate with `devtools/shared/worker`.
|
||||
*/
|
||||
importScripts("resource://gre/modules/workers/require.js");
|
||||
const { createTask } = require("resource:///modules/devtools/shared/worker-helper");
|
||||
|
||||
/**
|
||||
* @see LineGraphWidget.prototype.setDataFromTimestamps in Graphs.jsm
|
||||
@ -23,13 +16,13 @@ self.onmessage = e => {
|
||||
* @param number interval
|
||||
* @param number duration
|
||||
*/
|
||||
function plotTimestampsGraph(id, args) {
|
||||
let plottedData = plotTimestamps(args.timestamps, args.interval);
|
||||
let plottedMinMaxSum = getMinMaxAvg(plottedData, args.timestamps, args.duration);
|
||||
createTask(self, "plotTimestampsGraph", function ({ timestamps, interval, duration }) {
|
||||
let plottedData = plotTimestamps(timestamps, interval);
|
||||
let plottedMinMaxSum = getMinMaxAvg(plottedData, timestamps, duration);
|
||||
|
||||
return { plottedData, plottedMinMaxSum };
|
||||
});
|
||||
|
||||
let response = { id, plottedData, plottedMinMaxSum };
|
||||
self.postMessage(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min, max and average of the values in an array.
|
||||
|
@ -163,6 +163,10 @@ Spectrum.draggable = function(element, onmove, onstart, onstop) {
|
||||
|
||||
function move(e) {
|
||||
if (dragging) {
|
||||
if (e.buttons === 0) {
|
||||
// The button is no longer pressed but we did not get a mouseup event.
|
||||
return stop();
|
||||
}
|
||||
let pageX = e.pageX;
|
||||
let pageY = e.pageY;
|
||||
|
||||
|
100
browser/devtools/shared/worker-helper.js
Normal file
100
browser/devtools/shared/worker-helper.js
Normal file
@ -0,0 +1,100 @@
|
||||
/* 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/. */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This file is to only be included by ChromeWorkers. This exposes
|
||||
* a `createTask` function to workers to register tasks for communication
|
||||
* back to `devtools/shared/worker`.
|
||||
*
|
||||
* Tasks can be send their responses via a return value, either a primitive
|
||||
* or a promise.
|
||||
*
|
||||
* createTask(self, "average", function (data) {
|
||||
* return data.reduce((sum, val) => sum + val, 0) / data.length;
|
||||
* });
|
||||
*
|
||||
* createTask(self, "average", function (data) {
|
||||
* return new Promise((resolve, reject) => {
|
||||
* resolve(data.reduce((sum, val) => sum + val, 0) / data.length);
|
||||
* });
|
||||
* });
|
||||
*
|
||||
*
|
||||
* Errors:
|
||||
*
|
||||
* Returning an Error value, or if the returned promise is rejected, this
|
||||
* propagates to the DevToolsWorker as a rejected promise. If an error is
|
||||
* thrown in a synchronous function, that error is also propagated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Takes a worker's `self` object, a task name, and a function to
|
||||
* be called when that task is called. The task is called with the
|
||||
* passed in data as the first argument
|
||||
*
|
||||
* @param {object} self
|
||||
* @param {string} name
|
||||
* @param {function} fn
|
||||
*/
|
||||
function createTask (self, name, fn) {
|
||||
// Store a hash of task name to function on the Worker
|
||||
if (!self._tasks) {
|
||||
self._tasks = {};
|
||||
}
|
||||
|
||||
// Create the onmessage handler if not yet created.
|
||||
if (!self.onmessage) {
|
||||
self.onmessage = createHandler(self);
|
||||
}
|
||||
|
||||
// Store the task on the worker.
|
||||
self._tasks[name] = fn;
|
||||
}
|
||||
|
||||
exports.createTask = createTask;
|
||||
|
||||
/**
|
||||
* Creates the `self.onmessage` handler for a Worker.
|
||||
*
|
||||
* @param {object} self
|
||||
* @return {function}
|
||||
*/
|
||||
function createHandler (self) {
|
||||
return function (e) {
|
||||
let { id, task, data } = e.data;
|
||||
let taskFn = self._tasks[task];
|
||||
|
||||
if (!taskFn) {
|
||||
self.postMessage({ id, error: `Task "${task}" not found in worker.` });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
let results;
|
||||
handleResponse(taskFn(data));
|
||||
} catch (e) {
|
||||
handleError(e);
|
||||
}
|
||||
|
||||
function handleResponse (response) {
|
||||
// If a promise
|
||||
if (response && typeof response.then === "function") {
|
||||
response.then(val => self.postMessage({ id, response: val }), handleError);
|
||||
}
|
||||
// If an error object
|
||||
else if (response instanceof Error) {
|
||||
handleError(response);
|
||||
}
|
||||
// If anything else
|
||||
else {
|
||||
self.postMessage({ id, response });
|
||||
}
|
||||
}
|
||||
|
||||
function handleError (e="Error") {
|
||||
self.postMessage({ id, error: e.message || e });
|
||||
}
|
||||
}
|
||||
}
|
134
browser/devtools/shared/worker.js
Normal file
134
browser/devtools/shared/worker.js
Normal file
@ -0,0 +1,134 @@
|
||||
/* 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/. */
|
||||
"use strict";
|
||||
|
||||
(function (factory) { // Module boilerplate
|
||||
if (this.module && module.id.indexOf("worker") >= 0) { // require
|
||||
const { Cc, Ci, ChromeWorker } = require("chrome");
|
||||
factory.call(this, require, exports, module, { Cc, Ci }, ChromeWorker);
|
||||
} else { // Cu.import
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
this.isWorker = false;
|
||||
this.Promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
|
||||
this.console = Cu.import("resource://gre/modules/devtools/Console.jsm", {}).console;
|
||||
factory.call(this, devtools.require, this, { exports: this }, { Cc, Ci }, ChromeWorker);
|
||||
this.EXPORTED_SYMBOLS = ["DevToolsWorker"];
|
||||
}
|
||||
}).call(this, function (require, exports, module, { Ci, Cc }, ChromeWorker ) {
|
||||
|
||||
let MESSAGE_COUNTER = 0;
|
||||
|
||||
/**
|
||||
* Creates a wrapper around a ChromeWorker, providing easy
|
||||
* communication to offload demanding tasks. The corresponding URL
|
||||
* must implement the interface provided by `devtools/shared/worker-helper`.
|
||||
*
|
||||
* @see `./browser/devtools/shared/widgets/GraphsWorker.js`
|
||||
*
|
||||
* @param {string} url
|
||||
* The URL of the worker.
|
||||
*/
|
||||
function DevToolsWorker (url) {
|
||||
this._worker = new ChromeWorker(url);
|
||||
}
|
||||
exports.DevToolsWorker = DevToolsWorker;
|
||||
|
||||
/**
|
||||
* Performs the given task in a chrome worker, passing in data.
|
||||
* Returns a promise that resolves when the task is completed, resulting in
|
||||
* the return value of the task.
|
||||
*
|
||||
* @param {string} task
|
||||
* The name of the task to execute in the worker.
|
||||
* @param {any} data
|
||||
* Data to be passed into the task implemented by the worker.
|
||||
* @return {Promise}
|
||||
*/
|
||||
DevToolsWorker.prototype.performTask = function DevToolsWorkerPerformTask (task, data) {
|
||||
if (this._destroyed) {
|
||||
return Promise.reject("Cannot call performTask on a destroyed DevToolsWorker");
|
||||
}
|
||||
let worker = this._worker;
|
||||
let id = ++MESSAGE_COUNTER;
|
||||
worker.postMessage({ task, id, data });
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
worker.addEventListener("message", function listener({ data }) {
|
||||
if (data.id !== id) {
|
||||
return;
|
||||
}
|
||||
worker.removeEventListener("message", listener);
|
||||
if (data.error) {
|
||||
reject(data.error);
|
||||
} else {
|
||||
resolve(data.response);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminates the underlying worker. Use when no longer needing the worker.
|
||||
*/
|
||||
DevToolsWorker.prototype.destroy = function DevToolsWorkerDestroy () {
|
||||
this._worker.terminate();
|
||||
this._worker = null;
|
||||
this._destroyed = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a function and returns a Worker-wrapped version of the same function.
|
||||
* Returns a promise upon resolution.
|
||||
* @see `./browser/devtools/shared/test/browser_devtools-worker-03.js
|
||||
*
|
||||
* * * * ! ! ! This should only be used for tests or A/B testing performance ! ! ! * * * * * *
|
||||
*
|
||||
* The original function must:
|
||||
*
|
||||
* Be a pure function, that is, not use any variables not declared within the
|
||||
* function, or its arguments.
|
||||
*
|
||||
* Return a value or a promise.
|
||||
*
|
||||
* Note any state change in the worker will not affect the callee's context.
|
||||
*
|
||||
* @param {function} fn
|
||||
* @return {function}
|
||||
*/
|
||||
function workerify (fn) {
|
||||
console.warn(`\`workerify\` should only be used in tests or measuring performance.
|
||||
This creates an object URL on the browser window, and should not be used in production.`)
|
||||
// Fetch via window/utils here as we don't want to include
|
||||
// this module normally.
|
||||
let { getMostRecentBrowserWindow } = require("sdk/window/utils");
|
||||
let { URL, Blob } = getMostRecentBrowserWindow();
|
||||
let stringifiedFn = createWorkerString(fn);
|
||||
let blob = new Blob([stringifiedFn]);
|
||||
let url = URL.createObjectURL(blob);
|
||||
let worker = new DevToolsWorker(url);
|
||||
|
||||
let wrapperFn = data => worker.performTask("workerifiedTask", data);
|
||||
|
||||
wrapperFn.destroy = function () {
|
||||
URL.revokeObjectURL(url);
|
||||
worker.destroy();
|
||||
};
|
||||
|
||||
return wrapperFn;
|
||||
}
|
||||
exports.workerify = workerify;
|
||||
|
||||
/**
|
||||
* Takes a function, and stringifies it, attaching the worker-helper.js
|
||||
* boilerplate hooks.
|
||||
*/
|
||||
function createWorkerString (fn) {
|
||||
return `importScripts("resource://gre/modules/workers/require.js");
|
||||
const { createTask } = require("resource:///modules/devtools/shared/worker-helper");
|
||||
createTask(self, "workerifiedTask", ${fn.toString()});
|
||||
`;
|
||||
}
|
||||
|
||||
});
|
@ -62,6 +62,7 @@ support-files =
|
||||
[browser_ruleview_colorpicker-edit-gradient.js]
|
||||
[browser_ruleview_colorpicker-hides-on-tooltip.js]
|
||||
[browser_ruleview_colorpicker-multiple-changes.js]
|
||||
[browser_ruleview_colorpicker-release-outside-frame.js]
|
||||
[browser_ruleview_colorpicker-revert-on-ESC.js]
|
||||
[browser_ruleview_colorpicker-swatch-displayed.js]
|
||||
[browser_ruleview_completion-existing-property_01.js]
|
||||
|
@ -0,0 +1,64 @@
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that color pickers stops following the pointer if the pointer is
|
||||
// released outside the tooltip frame (bug 1160720).
|
||||
|
||||
const PAGE_CONTENT = "data:text/html;charset=utf-8," +
|
||||
'<body style="color: red">Test page for bug 1160720';
|
||||
|
||||
add_task(function*() {
|
||||
yield addTab(PAGE_CONTENT);
|
||||
let {toolbox, inspector, view} = yield openRuleView();
|
||||
|
||||
let cSwatch = getRuleViewProperty(view, "element", "color").valueSpan
|
||||
.querySelector(".ruleview-colorswatch");
|
||||
|
||||
let picker = yield openColorPickerForSwatch(cSwatch, view);
|
||||
let spectrum = yield picker.spectrum;
|
||||
let change = spectrum.once("changed");
|
||||
|
||||
info("Pressing mouse down over color picker.");
|
||||
EventUtils.synthesizeMouseAtCenter(spectrum.dragger, {
|
||||
type: "mousedown",
|
||||
}, spectrum.dragger.ownerDocument.defaultView);
|
||||
|
||||
let value = yield change;
|
||||
info(`Color changed to ${value} on mousedown.`);
|
||||
|
||||
// If the mousemove below fails to detect that the button is no longer pressed
|
||||
// the spectrum will update and emit changed event synchronously after calling
|
||||
// synthesizeMouse so this handler is executed before the test ends.
|
||||
spectrum.once("changed", (event, newValue) => {
|
||||
is(newValue, value, "Value changed on mousemove without a button pressed.");
|
||||
});
|
||||
|
||||
// Releasing the button pressed by mousedown above on top of a different frame
|
||||
// does not make sense in this test as EventUtils doesn't preserve the context
|
||||
// i.e. the buttons that were pressed down between events.
|
||||
|
||||
info("Moving mouse over color picker without any buttons pressed.");
|
||||
EventUtils.synthesizeMouse(spectrum.dragger, 10, 10, {
|
||||
button: -1, // -1 = no buttons are pressed down
|
||||
type: "mousemove",
|
||||
}, spectrum.dragger.ownerDocument.defaultView);
|
||||
});
|
||||
|
||||
function* openColorPickerForSwatch(swatch, view) {
|
||||
let cPicker = view.tooltips.colorPicker;
|
||||
ok(cPicker, "The rule-view has the expected colorPicker property");
|
||||
|
||||
let cPickerPanel = cPicker.tooltip.panel;
|
||||
ok(cPickerPanel, "The XUL panel for the color picker exists");
|
||||
|
||||
let onShown = cPicker.tooltip.once("shown");
|
||||
swatch.click();
|
||||
yield onShown;
|
||||
|
||||
ok(true, "The color picker was shown on click of the color swatch");
|
||||
|
||||
return cPicker;
|
||||
}
|
@ -48,20 +48,27 @@ exports.items = [
|
||||
hidden: true,
|
||||
state: {
|
||||
isChecked: function(aTarget) {
|
||||
if (!aTarget.tab) {
|
||||
return false;
|
||||
}
|
||||
let browserWindow = aTarget.tab.ownerDocument.defaultView;
|
||||
return !!TiltManager.getTiltForBrowser(browserWindow).currentInstance;
|
||||
},
|
||||
onChange: function(aTarget, aChangeHandler) {
|
||||
if (!aTarget.tab) {
|
||||
return;
|
||||
}
|
||||
let browserWindow = aTarget.tab.ownerDocument.defaultView;
|
||||
let tilt = TiltManager.getTiltForBrowser(browserWindow);
|
||||
tilt.on("change", aChangeHandler);
|
||||
},
|
||||
offChange: function(aTarget, aChangeHandler) {
|
||||
if (aTarget.tab) {
|
||||
let browserWindow = aTarget.tab.ownerDocument.defaultView;
|
||||
let tilt = TiltManager.getTiltForBrowser(browserWindow);
|
||||
tilt.off("change", aChangeHandler);
|
||||
if (!aTarget.tab) {
|
||||
return;
|
||||
}
|
||||
let browserWindow = aTarget.tab.ownerDocument.defaultView;
|
||||
let tilt = TiltManager.getTiltForBrowser(browserWindow);
|
||||
tilt.off("change", aChangeHandler);
|
||||
},
|
||||
},
|
||||
exec: function(args, context) {
|
||||
|
@ -149,6 +149,7 @@ Below is an example directory source file::
|
||||
"wiki.mozilla.org"
|
||||
],
|
||||
"imageURI": "https://tiles.cdn.mozilla.net/images/9ee2b265678f2775de2e4bf680df600b502e6038.3875.png",
|
||||
"time_limits": {"start": "2014-01-01T00:00:00.000Z", "end": "2014-02-01T00:00:00.000Z"},
|
||||
"title": "Thanks for testing!",
|
||||
"type": "affiliate",
|
||||
"url": "https://www.mozilla.com/firefox/tiles"
|
||||
@ -182,6 +183,9 @@ A suggested link has additional values:
|
||||
Suggested Tile if the user has the site in one of the top 100 most-frecent
|
||||
pages. Only preapproved array of strings that are hardcoded into the
|
||||
DirectoryLinksProvider module are allowed.
|
||||
- ``time_limits`` - an object consisting of start and end timestamps specifying
|
||||
when a Suggested Tile may start and has to stop showing in the newtab.
|
||||
The timestamp is expected in ISO_8601 format: '2014-01-10T20:00:00.000Z'
|
||||
|
||||
The preapproved arrays follow a policy for determining what topic grouping is
|
||||
allowed as well as the composition of a grouping. The topics are broad
|
||||
|
@ -44,8 +44,6 @@
|
||||
locale/browser/devtools/canvasdebugger.properties (%chrome/browser/devtools/canvasdebugger.properties)
|
||||
locale/browser/devtools/webaudioeditor.dtd (%chrome/browser/devtools/webaudioeditor.dtd)
|
||||
locale/browser/devtools/webaudioeditor.properties (%chrome/browser/devtools/webaudioeditor.properties)
|
||||
locale/browser/devtools/gcli.properties (%chrome/browser/devtools/gcli.properties)
|
||||
locale/browser/devtools/gclicommands.properties (%chrome/browser/devtools/gclicommands.properties)
|
||||
locale/browser/devtools/webconsole.properties (%chrome/browser/devtools/webconsole.properties)
|
||||
locale/browser/devtools/inspector.properties (%chrome/browser/devtools/inspector.properties)
|
||||
locale/browser/devtools/tilt.properties (%chrome/browser/devtools/tilt.properties)
|
||||
|
@ -250,6 +250,7 @@ let DirectoryLinksProvider = {
|
||||
for (let suggestedSite of link.frecent_sites) {
|
||||
let suggestedMap = this._suggestedLinks.get(suggestedSite) || new Map();
|
||||
suggestedMap.set(link.url, link);
|
||||
this._setupStartEndTime(link);
|
||||
this._suggestedLinks.set(suggestedSite, suggestedMap);
|
||||
}
|
||||
},
|
||||
@ -365,6 +366,97 @@ let DirectoryLinksProvider = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Translates link.time_limits to UTC miliseconds and sets
|
||||
* link.startTime and link.endTime properties in link object
|
||||
*/
|
||||
_setupStartEndTime: function DirectoryLinksProvider_setupStartEndTime(link) {
|
||||
// set start/end limits. Use ISO_8601 format: '2014-01-10T20:20:20.600Z'
|
||||
// (details here http://en.wikipedia.org/wiki/ISO_8601)
|
||||
// Note that if timezone is missing, FX will interpret as local time
|
||||
// meaning that the server can sepecify any time, but if the capmaign
|
||||
// needs to start at same time across multiple timezones, the server
|
||||
// omits timezone indicator
|
||||
if (!link.time_limits) {
|
||||
return;
|
||||
}
|
||||
|
||||
let parsedTime;
|
||||
if (link.time_limits.start) {
|
||||
parsedTime = Date.parse(link.time_limits.start);
|
||||
if (parsedTime && !isNaN(parsedTime)) {
|
||||
link.startTime = parsedTime;
|
||||
}
|
||||
}
|
||||
if (link.time_limits.end) {
|
||||
parsedTime = Date.parse(link.time_limits.end);
|
||||
if (parsedTime && !isNaN(parsedTime)) {
|
||||
link.endTime = parsedTime;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Handles campaign timeout
|
||||
*/
|
||||
_onCampaignTimeout: function DirectoryLinksProvider_onCampaignTimeout() {
|
||||
// _campaignTimeoutID is invalid here, so just set it to null
|
||||
this._campaignTimeoutID = null;
|
||||
this._updateSuggestedTile();
|
||||
},
|
||||
|
||||
/*
|
||||
* Clears capmpaign timeout
|
||||
*/
|
||||
_clearCampaignTimeout: function DirectoryLinksProvider_clearCampaignTimeout() {
|
||||
if (this._campaignTimeoutID) {
|
||||
clearTimeout(this._campaignTimeoutID);
|
||||
this._campaignTimeoutID = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Setup capmpaign timeout to recompute suggested tiles upon
|
||||
* reaching soonest start or end time for the campaign
|
||||
* @param timeout in milliseconds
|
||||
*/
|
||||
_setupCampaignTimeCheck: function DirectoryLinksProvider_setupCampaignTimeCheck(timeout) {
|
||||
// sanity check
|
||||
if (!timeout || timeout <= 0) {
|
||||
return;
|
||||
}
|
||||
this._clearCampaignTimeout();
|
||||
// setup next timeout
|
||||
this._campaignTimeoutID = setTimeout(this._onCampaignTimeout.bind(this), timeout);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test link for campaign time limits: checks if link falls within start/end time
|
||||
* and returns an object containing a use flag and the timeoutDate milliseconds
|
||||
* when the link has to be re-checked for campaign start-ready or end-reach
|
||||
* @param link
|
||||
* @return object {use: true or false, timeoutDate: milliseconds or null}
|
||||
*/
|
||||
_testLinkForCampaignTimeLimits: function DirectoryLinksProvider_testLinkForCampaignTimeLimits(link) {
|
||||
let currentTime = Date.now();
|
||||
// test for start time first
|
||||
if (link.startTime && link.startTime > currentTime) {
|
||||
// not yet ready for start
|
||||
return {use: false, timeoutDate: link.startTime};
|
||||
}
|
||||
// otherwise check for end time
|
||||
if (link.endTime) {
|
||||
// passed end time
|
||||
if (link.endTime <= currentTime) {
|
||||
return {use: false};
|
||||
}
|
||||
// otherwise link is still ok, but we need to set timeoutDate
|
||||
return {use: true, timeoutDate: link.endTime};
|
||||
}
|
||||
// if we are here, the link is ok and no timeoutDate needed
|
||||
return {use: true};
|
||||
},
|
||||
|
||||
/**
|
||||
* Report some action on a newtab page (view, click)
|
||||
* @param sites Array of sites shown on newtab page
|
||||
@ -490,6 +582,7 @@ let DirectoryLinksProvider = {
|
||||
this._enhancedLinks.clear();
|
||||
this._frequencyCaps.clear();
|
||||
this._suggestedLinks.clear();
|
||||
this._clearCampaignTimeout();
|
||||
|
||||
let validityFilter = function(link) {
|
||||
// Make sure the link url is allowed and images too if they exist
|
||||
@ -705,6 +798,7 @@ let DirectoryLinksProvider = {
|
||||
// want to count each suggested link once (based on url), thus possibleLinks is a map
|
||||
// from url to suggestedLink. Thus, each link has an equal chance of being chosen at
|
||||
// random from flattenedLinks if it appears only once.
|
||||
let nextTimeout;
|
||||
let possibleLinks = new Map();
|
||||
let targetedSites = new Map();
|
||||
this._topSitesWithSuggestedLinks.forEach(topSiteWithSuggestedLink => {
|
||||
@ -715,6 +809,18 @@ let DirectoryLinksProvider = {
|
||||
return;
|
||||
}
|
||||
|
||||
// as we iterate suggestedLinks, check for campaign start/end
|
||||
// time limits, and set nextTimeout to the closest timestamp
|
||||
let {use, timeoutDate} = this._testLinkForCampaignTimeLimits(suggestedLink);
|
||||
// update nextTimeout is necessary
|
||||
if (timeoutDate && (!nextTimeout || nextTimeout > timeoutDate)) {
|
||||
nextTimeout = timeoutDate;
|
||||
}
|
||||
// Skip link if it falls outside campaign time limits
|
||||
if (!use) {
|
||||
return;
|
||||
}
|
||||
|
||||
possibleLinks.set(url, suggestedLink);
|
||||
|
||||
// Keep a map of URL to targeted sites. We later use this to show the user
|
||||
@ -726,6 +832,11 @@ let DirectoryLinksProvider = {
|
||||
})
|
||||
});
|
||||
|
||||
// setup timeout check for starting or ending campaigns
|
||||
if (nextTimeout) {
|
||||
this._setupCampaignTimeCheck(nextTimeout - Date.now());
|
||||
}
|
||||
|
||||
// We might have run out of possible links to show
|
||||
let numLinks = possibleLinks.size;
|
||||
if (numLinks == 0) {
|
||||
|
@ -1226,3 +1226,176 @@ add_task(function test_DirectoryLinksProvider_setDefaultEnhanced() {
|
||||
// Clean up
|
||||
Services.prefs.clearUserPref("privacy.donottrackheader.value");
|
||||
});
|
||||
|
||||
add_task(function test_timeSensetiveSuggestedTiles() {
|
||||
// make tile json with start and end dates
|
||||
let testStartTime = Date.now();
|
||||
// start date is now + 1 seconds
|
||||
let startDate = new Date(testStartTime + 1000);
|
||||
// end date is now + 3 seconds
|
||||
let endDate = new Date(testStartTime + 3000);
|
||||
let suggestedTile = Object.assign({
|
||||
time_limits: {
|
||||
start: startDate.toISOString(),
|
||||
end: endDate.toISOString(),
|
||||
}
|
||||
}, suggestedTile1);
|
||||
|
||||
// Initial setup
|
||||
let topSites = ["site0.com", "1040.com", "site2.com", "hrblock.com", "site4.com", "freetaxusa.com", "site6.com"];
|
||||
let data = {"suggested": [suggestedTile], "directory": [someOtherSite]};
|
||||
let dataURI = 'data:application/json,' + JSON.stringify(data);
|
||||
|
||||
let testObserver = new TestTimingRun();
|
||||
DirectoryLinksProvider.addObserver(testObserver);
|
||||
|
||||
let origGetFrecentSitesName = DirectoryLinksProvider.getFrecentSitesName;
|
||||
DirectoryLinksProvider.getFrecentSitesName = () => "";
|
||||
|
||||
yield promiseSetupDirectoryLinksProvider({linksURL: dataURI});
|
||||
let links = yield fetchData();
|
||||
|
||||
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
|
||||
NewTabUtils.isTopPlacesSite = function(site) {
|
||||
return topSites.indexOf(site) >= 0;
|
||||
}
|
||||
|
||||
let origGetProviderLinks = NewTabUtils.getProviderLinks;
|
||||
NewTabUtils.getProviderLinks = function(provider) {
|
||||
return links;
|
||||
}
|
||||
|
||||
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
|
||||
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
|
||||
|
||||
do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
|
||||
|
||||
// this tester will fire twice: when start limit is reached and when tile link
|
||||
// is removed upon end of the campaign, in which case deleteFlag will be set
|
||||
function TestTimingRun() {
|
||||
this.promise = new Promise(resolve => {
|
||||
this.onLinkChanged = (directoryLinksProvider, link, ignoreFlag, deleteFlag) => {
|
||||
// if we are not deleting, add link to links, so we can catch it's removal
|
||||
if (!deleteFlag) {
|
||||
links.unshift(link);
|
||||
}
|
||||
|
||||
isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], ["hrblock.com", "1040.com"]);
|
||||
do_check_eq(link.frecency, SUGGESTED_FRECENCY);
|
||||
do_check_eq(link.type, "affiliate");
|
||||
do_check_eq(link.url, suggestedTile.url);
|
||||
let timeDelta = Date.now() - testStartTime;
|
||||
if (!deleteFlag) {
|
||||
// this is start timeout corresponding to campaign start
|
||||
// a seconds must pass and targetedSite must be set
|
||||
do_check_true(timeDelta >= 1000);
|
||||
do_check_eq(link.targetedSite, "hrblock.com");
|
||||
do_check_true(DirectoryLinksProvider._campaignTimeoutID);
|
||||
}
|
||||
else {
|
||||
// this is the campaign end timeout, so 3 seconds must pass
|
||||
// and timeout should be cleared
|
||||
do_check_true(timeDelta >= 3000);
|
||||
do_check_false(link.targetedSite);
|
||||
do_check_false(DirectoryLinksProvider._campaignTimeoutID);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// _updateSuggestedTile() is called when fetching directory links.
|
||||
yield testObserver.promise;
|
||||
DirectoryLinksProvider.removeObserver(testObserver);
|
||||
|
||||
// shoudl suggest nothing
|
||||
do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
|
||||
|
||||
// set links back to contain directory tile only
|
||||
links.shift();
|
||||
|
||||
// drop the end time - we should pick up the tile
|
||||
suggestedTile.time_limits.end = null;
|
||||
data = {"suggested": [suggestedTile], "directory": [someOtherSite]};
|
||||
dataURI = 'data:application/json,' + JSON.stringify(data);
|
||||
|
||||
// redownload json and getLinks to force time recomputation
|
||||
yield promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, dataURI);
|
||||
|
||||
// ensure that there's a link returned by _updateSuggestedTile and no timeout
|
||||
let deferred = Promise.defer();
|
||||
DirectoryLinksProvider.getLinks(() => {
|
||||
let link = DirectoryLinksProvider._updateSuggestedTile();
|
||||
// we should have a suggested tile and no timeout
|
||||
do_check_eq(link.type, "affiliate");
|
||||
do_check_eq(link.url, suggestedTile.url);
|
||||
do_check_false(DirectoryLinksProvider._campaignTimeoutID);
|
||||
deferred.resolve();
|
||||
});
|
||||
yield deferred.promise;
|
||||
|
||||
// repeat the test for end time only
|
||||
suggestedTile.time_limits.start = null;
|
||||
suggestedTile.time_limits.end = (new Date(Date.now() + 3000)).toISOString();
|
||||
|
||||
data = {"suggested": [suggestedTile], "directory": [someOtherSite]};
|
||||
dataURI = 'data:application/json,' + JSON.stringify(data);
|
||||
|
||||
// redownload json and call getLinks() to force time recomputation
|
||||
yield promiseDirectoryDownloadOnPrefChange(kSourceUrlPref, dataURI);
|
||||
|
||||
// ensure that there's a link returned by _updateSuggestedTile and timeout set
|
||||
deferred = Promise.defer();
|
||||
DirectoryLinksProvider.getLinks(() => {
|
||||
let link = DirectoryLinksProvider._updateSuggestedTile();
|
||||
// we should have a suggested tile and timeout set
|
||||
do_check_eq(link.type, "affiliate");
|
||||
do_check_eq(link.url, suggestedTile.url);
|
||||
do_check_true(DirectoryLinksProvider._campaignTimeoutID);
|
||||
DirectoryLinksProvider._clearCampaignTimeout();
|
||||
deferred.resolve();
|
||||
});
|
||||
yield deferred.promise;
|
||||
|
||||
// Cleanup
|
||||
yield promiseCleanDirectoryLinksProvider();
|
||||
DirectoryLinksProvider.getFrecentSitesName = origGetFrecentSitesName;
|
||||
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
|
||||
NewTabUtils.getProviderLinks = origGetProviderLinks;
|
||||
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
|
||||
});
|
||||
|
||||
add_task(function test_setupStartEndTime() {
|
||||
let currentTime = Date.now();
|
||||
let dt = new Date(currentTime);
|
||||
let link = {
|
||||
time_limits: {
|
||||
start: dt.toISOString()
|
||||
}
|
||||
};
|
||||
|
||||
// test ISO translation
|
||||
DirectoryLinksProvider._setupStartEndTime(link);
|
||||
do_check_eq(link.startTime, currentTime);
|
||||
|
||||
// test localtime translation
|
||||
let shiftedDate = new Date(currentTime - dt.getTimezoneOffset()*60*1000);
|
||||
link.time_limits.start = shiftedDate.toISOString().replace(/Z$/, "");
|
||||
|
||||
DirectoryLinksProvider._setupStartEndTime(link);
|
||||
do_check_eq(link.startTime, currentTime);
|
||||
|
||||
// throw some garbage into date string
|
||||
delete link.startTime;
|
||||
link.time_limits.start = "no date"
|
||||
DirectoryLinksProvider._setupStartEndTime(link);
|
||||
do_check_false(link.startTime);
|
||||
|
||||
link.time_limits.start = "2015-99999-01T00:00:00"
|
||||
DirectoryLinksProvider._setupStartEndTime(link);
|
||||
do_check_false(link.startTime);
|
||||
|
||||
link.time_limits.start = "20150501T00:00:00"
|
||||
DirectoryLinksProvider._setupStartEndTime(link);
|
||||
do_check_false(link.startTime);
|
||||
});
|
||||
|
@ -415,6 +415,7 @@
|
||||
-moz-padding-end: 8px;
|
||||
padding-top: 2vh;
|
||||
overflow: auto;
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
.marker-details-bullet {
|
||||
|
@ -11,7 +11,8 @@ namespace mozilla {
|
||||
|
||||
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
|
||||
|
||||
LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase)
|
||||
LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
||||
nsILoadContext* aOptionalBase)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(0)
|
||||
, mIsContent(true)
|
||||
@ -22,17 +23,18 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase
|
||||
#endif
|
||||
{
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
||||
|
||||
if (!aOptionalBase) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetIsContent(&mIsContent)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aOptionalBase->GetUsePrivateBrowsing(&mUsePrivateBrowsing)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// AppId/inBrowser arguments override those in SerializedLoadContext provided
|
||||
// by child process.
|
||||
@ -70,7 +71,8 @@ public:
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
LoadContext(dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId,
|
||||
@ -88,7 +90,8 @@ public:
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor taking reserved appId for the safebrowsing cookie.
|
||||
explicit LoadContext(uint32_t aAppId)
|
||||
@ -102,7 +105,8 @@ public:
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor for creating a LoadContext with a given principal's appId and
|
||||
// browser flag.
|
||||
@ -127,4 +131,3 @@ private:
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // LoadContext_h
|
||||
|
||||
|
@ -77,4 +77,3 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
|
@ -72,11 +72,11 @@ struct ParamTraits<SerializedLoadContext>
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) {
|
||||
return false;
|
||||
}
|
||||
@ -88,4 +88,3 @@ struct ParamTraits<SerializedLoadContext>
|
||||
} // namespace IPC
|
||||
|
||||
#endif // SerializedLoadContext_h
|
||||
|
||||
|
@ -26,10 +26,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDSURIContentListener: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsDSURIContentListener::nsDSURIContentListener(nsDocShell* aDocShell)
|
||||
: mDocShell(aDocShell)
|
||||
, mExistingJPEGRequest(nullptr)
|
||||
@ -50,10 +46,6 @@ nsDSURIContentListener::Init()
|
||||
return rv;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDSURIContentListener::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsDSURIContentListener)
|
||||
NS_IMPL_RELEASE(nsDSURIContentListener)
|
||||
|
||||
@ -63,16 +55,11 @@ NS_INTERFACE_MAP_BEGIN(nsDSURIContentListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDSURIContentListener::nsIURIContentListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDSURIContentListener::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen)
|
||||
{
|
||||
// If mDocShell is null here, that means someone's starting a load
|
||||
// in our docshell after it's already been destroyed. Don't let
|
||||
// that happen.
|
||||
// If mDocShell is null here, that means someone's starting a load in our
|
||||
// docshell after it's already been destroyed. Don't let that happen.
|
||||
if (!mDocShell) {
|
||||
*aAbortOpen = true;
|
||||
return NS_OK;
|
||||
@ -188,17 +175,16 @@ nsDSURIContentListener::IsPreferred(const char* aContentType,
|
||||
aDesiredContentType,
|
||||
aCanHandle);
|
||||
}
|
||||
// we used to return false here if we didn't have a parent properly
|
||||
// registered at the top of the docshell hierarchy to dictate what
|
||||
// content types this docshell should be a preferred handler for. But
|
||||
// this really makes it hard for developers using iframe or browser tags
|
||||
// because then they need to make sure they implement
|
||||
// nsIURIContentListener otherwise all link clicks would get sent to
|
||||
// another window because we said we weren't the preferred handler type.
|
||||
// I'm going to change the default now...if we can handle the content,
|
||||
// and someone didn't EXPLICITLY set a nsIURIContentListener at the top
|
||||
// of our docshell chain, then we'll now always attempt to process the
|
||||
// content ourselves...
|
||||
// we used to return false here if we didn't have a parent properly registered
|
||||
// at the top of the docshell hierarchy to dictate what content types this
|
||||
// docshell should be a preferred handler for. But this really makes it hard
|
||||
// for developers using iframe or browser tags because then they need to make
|
||||
// sure they implement nsIURIContentListener otherwise all link clicks would
|
||||
// get sent to another window because we said we weren't the preferred handler
|
||||
// type. I'm going to change the default now... if we can handle the content,
|
||||
// and someone didn't EXPLICITLY set a nsIURIContentListener at the top of our
|
||||
// docshell chain, then we'll now always attempt to process the content
|
||||
// ourselves...
|
||||
return CanHandleContent(aContentType, true, aDesiredContentType, aCanHandle);
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,8 @@ nsDefaultURIFixup::KeywordURIFixup(const nsACString& aURIString,
|
||||
|
||||
// If we're at the end of the string or this is the first slash,
|
||||
// check if the thing before the slash looks like ipv4:
|
||||
if ((iter.size_forward() == 1 || (lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) &&
|
||||
if ((iter.size_forward() == 1 ||
|
||||
(lastSlashLoc == uint32_t(kNotFound) && *iter == '/')) &&
|
||||
// Need 2 or 3 dots + only digits
|
||||
(foundDots == 2 || foundDots == 3) &&
|
||||
// and they should be all that came before now:
|
||||
|
@ -712,7 +712,8 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
|
||||
nsPingListener* pingListener =
|
||||
new nsPingListener(info->requireSameHost, aContent, loadGroup);
|
||||
|
||||
nsCOMPtr<nsINetworkInterceptController> interceptController = do_QueryInterface(info->docShell);
|
||||
nsCOMPtr<nsINetworkInterceptController> interceptController =
|
||||
do_QueryInterface(info->docShell);
|
||||
pingListener->SetInterceptController(interceptController);
|
||||
nsCOMPtr<nsIStreamListener> listener(pingListener);
|
||||
|
||||
@ -845,10 +846,6 @@ DecreasePrivateDocShellCount()
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsDocShell: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
static uint64_t gDocshellIDCounter = 0;
|
||||
|
||||
nsDocShell::nsDocShell()
|
||||
@ -1032,10 +1029,6 @@ nsDocShell::DestroyChildren()
|
||||
nsDocLoader::DestroyChildren();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
||||
|
||||
@ -1061,9 +1054,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
||||
NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
|
||||
|
||||
///*****************************************************************************
|
||||
// nsDocShell::nsIInterfaceRequestor
|
||||
//*****************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
||||
{
|
||||
@ -1361,9 +1351,6 @@ nsDocShell::ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType)
|
||||
return docShellLoadType;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIDocShell
|
||||
//*****************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadURI(nsIURI* aURI,
|
||||
nsIDocShellLoadInfo* aLoadInfo,
|
||||
@ -2610,14 +2597,16 @@ nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAllowContentRetargetingOnChildren(bool* aAllowContentRetargetingOnChildren)
|
||||
nsDocShell::GetAllowContentRetargetingOnChildren(
|
||||
bool* aAllowContentRetargetingOnChildren)
|
||||
{
|
||||
*aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetAllowContentRetargetingOnChildren(bool aAllowContentRetargetingOnChildren)
|
||||
nsDocShell::SetAllowContentRetargetingOnChildren(
|
||||
bool aAllowContentRetargetingOnChildren)
|
||||
{
|
||||
mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren;
|
||||
return NS_OK;
|
||||
@ -3489,7 +3478,8 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
|
||||
SetAllowWindowControl(value);
|
||||
}
|
||||
SetAllowContentRetargeting(parentAsDocShell->GetAllowContentRetargetingOnChildren());
|
||||
SetAllowContentRetargeting(
|
||||
parentAsDocShell->GetAllowContentRetargetingOnChildren());
|
||||
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
|
||||
SetIsActive(value);
|
||||
}
|
||||
@ -5611,6 +5601,7 @@ nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory)
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIWebPageDescriptor
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType)
|
||||
{
|
||||
@ -7174,7 +7165,7 @@ nsDocShell::RefreshURIFromQueue()
|
||||
timer->InitWithCallback(refreshInfo, delay, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
} // while
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -7821,20 +7812,19 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) &&
|
||||
(isTopFrame || UseErrorPages())) {
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
}
|
||||
else if (aStatus == NS_ERROR_NET_TIMEOUT ||
|
||||
aStatus == NS_ERROR_REDIRECT_LOOP ||
|
||||
aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE ||
|
||||
aStatus == NS_ERROR_NET_INTERRUPT ||
|
||||
aStatus == NS_ERROR_NET_RESET ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
aStatus == NS_ERROR_MALWARE_URI ||
|
||||
aStatus == NS_ERROR_PHISHING_URI ||
|
||||
aStatus == NS_ERROR_UNWANTED_URI ||
|
||||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
|
||||
aStatus == NS_ERROR_REMOTE_XUL ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
|
||||
} else if (aStatus == NS_ERROR_NET_TIMEOUT ||
|
||||
aStatus == NS_ERROR_REDIRECT_LOOP ||
|
||||
aStatus == NS_ERROR_UNKNOWN_SOCKET_TYPE ||
|
||||
aStatus == NS_ERROR_NET_INTERRUPT ||
|
||||
aStatus == NS_ERROR_NET_RESET ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
aStatus == NS_ERROR_MALWARE_URI ||
|
||||
aStatus == NS_ERROR_PHISHING_URI ||
|
||||
aStatus == NS_ERROR_UNWANTED_URI ||
|
||||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
|
||||
aStatus == NS_ERROR_REMOTE_XUL ||
|
||||
aStatus == NS_ERROR_OFFLINE ||
|
||||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
|
||||
// Errors to be shown for any frame
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
} else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) {
|
||||
@ -7846,8 +7836,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
}
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
}
|
||||
}
|
||||
else if (url && NS_SUCCEEDED(aStatus)) {
|
||||
} else if (url && NS_SUCCEEDED(aStatus)) {
|
||||
// If we have a host
|
||||
mozilla::net::PredictorLearnRedirect(url, aChannel, this);
|
||||
}
|
||||
@ -8001,9 +7990,9 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||
blankDoc->SetSandboxFlags(mSandboxFlags);
|
||||
|
||||
// create a content viewer for us and the new document
|
||||
docFactory->CreateInstanceForDocument(NS_ISUPPORTS_CAST(nsIDocShell*, this),
|
||||
blankDoc, "view",
|
||||
getter_AddRefs(viewer));
|
||||
docFactory->CreateInstanceForDocument(
|
||||
NS_ISUPPORTS_CAST(nsIDocShell*, this), blankDoc, "view",
|
||||
getter_AddRefs(viewer));
|
||||
|
||||
// hook 'em up
|
||||
if (viewer) {
|
||||
@ -8405,8 +8394,8 @@ class MOZ_STACK_CLASS PresentationEventForgetter
|
||||
{
|
||||
public:
|
||||
explicit PresentationEventForgetter(
|
||||
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>&
|
||||
aRestorePresentationEvent)
|
||||
nsRevocableEventPtr<nsDocShell::RestorePresentationEvent>&
|
||||
aRestorePresentationEvent)
|
||||
: mRestorePresentationEvent(aRestorePresentationEvent)
|
||||
, mEvent(aRestorePresentationEvent.get())
|
||||
{
|
||||
@ -8785,7 +8774,8 @@ nsDocShell::RestoreFromHistory()
|
||||
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
|
||||
|
||||
bool allowContentRetargeting = childShell->GetAllowContentRetargeting();
|
||||
bool allowContentRetargetingOnChildren = childShell->GetAllowContentRetargetingOnChildren();
|
||||
bool allowContentRetargetingOnChildren =
|
||||
childShell->GetAllowContentRetargetingOnChildren();
|
||||
|
||||
uint32_t defaultLoadFlags;
|
||||
childShell->GetDefaultLoadFlags(&defaultLoadFlags);
|
||||
@ -8804,7 +8794,8 @@ nsDocShell::RestoreFromHistory()
|
||||
childShell->SetAllowMedia(allowMedia);
|
||||
childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
|
||||
childShell->SetAllowContentRetargeting(allowContentRetargeting);
|
||||
childShell->SetAllowContentRetargetingOnChildren(allowContentRetargetingOnChildren);
|
||||
childShell->SetAllowContentRetargetingOnChildren(
|
||||
allowContentRetargetingOnChildren);
|
||||
childShell->SetDefaultLoadFlags(defaultLoadFlags);
|
||||
|
||||
rv = childShell->BeginRestore(nullptr, false);
|
||||
@ -9085,8 +9076,9 @@ nsDocShell::CreateContentViewer(const nsACString& aContentType,
|
||||
aOpenedChannel->SetLoadFlags(loadFlags);
|
||||
|
||||
mLoadGroup->AddRequest(aRequest, nullptr);
|
||||
if (currentLoadGroup)
|
||||
if (currentLoadGroup) {
|
||||
currentLoadGroup->RemoveRequest(aRequest, nullptr, NS_BINDING_RETARGETED);
|
||||
}
|
||||
|
||||
// Update the notification callbacks, so that progress and
|
||||
// status information are sent to the right docshell...
|
||||
@ -9405,6 +9397,7 @@ nsDocShell::CheckLoadingPermissions()
|
||||
//*****************************************************************************
|
||||
// nsDocShell: Site Loading
|
||||
//*****************************************************************************
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef MOZ_PLACES
|
||||
@ -9515,7 +9508,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
NS_IMETHOD
|
||||
Run()
|
||||
{
|
||||
return mDocShell->InternalLoad(mURI, mReferrer,
|
||||
mReferrerPolicy,
|
||||
@ -11222,7 +11216,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
|
||||
updateSHistory = false;
|
||||
updateGHistory = false; // XXX Why global history too?
|
||||
}
|
||||
} // rootSH
|
||||
}
|
||||
|
||||
// Check if the url to be loaded is the same as the one already loaded.
|
||||
if (mCurrentURI) {
|
||||
@ -11823,9 +11817,9 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
nsCOMPtr<nsISHEntry> child;
|
||||
shContainer->GetChildAt(i, getter_AddRefs(child));
|
||||
shContainer->RemoveChild(child);
|
||||
} // for
|
||||
}
|
||||
entry->AbandonBFCacheEntry();
|
||||
} // shContainer
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new entry if necessary.
|
||||
@ -12166,7 +12160,8 @@ nsDocShell::WalkHistoryEntries(nsISHEntry* aRootEntry,
|
||||
if (aRootShell) {
|
||||
// Walk the children of aRootShell and see if one of them
|
||||
// has srcChild as a SHEntry.
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(aRootShell->mChildList);
|
||||
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(
|
||||
aRootShell->mChildList);
|
||||
while (iter.HasMore()) {
|
||||
nsDocShell* child = static_cast<nsDocShell*>(iter.GetNext());
|
||||
|
||||
@ -12939,10 +12934,6 @@ nsDocShell::SetLayoutHistoryState(nsILayoutHistoryState* aLayoutHistoryState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsRefreshTimer: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
nsRefreshTimer::nsRefreshTimer()
|
||||
: mDelay(0), mRepeat(false), mMetaRefresh(false)
|
||||
{
|
||||
@ -12952,10 +12943,6 @@ nsRefreshTimer::~nsRefreshTimer()
|
||||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsRefreshTimer::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ADDREF(nsRefreshTimer)
|
||||
NS_IMPL_RELEASE(nsRefreshTimer)
|
||||
|
||||
@ -12964,9 +12951,6 @@ NS_INTERFACE_MAP_BEGIN(nsRefreshTimer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
///*****************************************************************************
|
||||
// nsRefreshTimer::nsITimerCallback
|
||||
//******************************************************************************
|
||||
NS_IMETHODIMP
|
||||
nsRefreshTimer::Notify(nsITimer* aTimer)
|
||||
{
|
||||
@ -12981,9 +12965,6 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::InterfaceRequestorProxy
|
||||
//*****************************************************************************
|
||||
nsDocShell::InterfaceRequestorProxy::InterfaceRequestorProxy(
|
||||
nsIInterfaceRequestor* aRequestor)
|
||||
{
|
||||
@ -13022,8 +13003,9 @@ nsDocShell::SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer)
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (sURIFixup)
|
||||
if (sURIFixup) {
|
||||
rv = sURIFixup->CreateExposableURI(mCurrentURI, getter_AddRefs(baseURI));
|
||||
}
|
||||
|
||||
// Get the current document and set the base uri
|
||||
if (baseURI) {
|
||||
@ -13069,6 +13051,7 @@ nsDocShell::GetAuthPrompt(uint32_t aPromptReason, const nsIID& aIID,
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsILoadContext
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
|
||||
{
|
||||
@ -13321,8 +13304,6 @@ nsDocShell::SelectNone(void)
|
||||
return DoCommand("cmd_selectNone");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// link handling
|
||||
|
||||
class OnLinkClickEvent : public nsRunnable
|
||||
@ -13382,8 +13363,6 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::OnLinkClick(nsIContent* aContent,
|
||||
nsIURI* aURI,
|
||||
@ -13934,7 +13913,6 @@ nsDocShell::GetURLSearchParams()
|
||||
class JavascriptTimelineMarker : public TimelineMarker
|
||||
{
|
||||
public:
|
||||
|
||||
JavascriptTimelineMarker(nsDocShell* aDocShell, const char* aName,
|
||||
const char* aReason)
|
||||
: TimelineMarker(aDocShell, aName, TRACING_INTERVAL_START,
|
||||
@ -13949,7 +13927,7 @@ public:
|
||||
};
|
||||
|
||||
void
|
||||
nsDocShell::NotifyJSRunToCompletionStart(const char *aReason)
|
||||
nsDocShell::NotifyJSRunToCompletionStart(const char* aReason)
|
||||
{
|
||||
bool timelineOn = nsIDocShell::GetRecordProfileTimelineMarkers();
|
||||
|
||||
@ -14009,7 +13987,8 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aShouldIntercept)
|
||||
nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
|
||||
bool* aShouldIntercept)
|
||||
{
|
||||
*aShouldIntercept = false;
|
||||
if (mSandboxFlags) {
|
||||
@ -14017,7 +13996,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
|
||||
if (!swm) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -14037,7 +14016,7 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aSho
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm = services::GetServiceWorkerManager();
|
||||
if (!swm) {
|
||||
aChannel->Cancel();
|
||||
return NS_OK;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user