From 86c5f49920ad72c7f1cf683c4c9fcf02a8373035 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 01:47:00 -0800 Subject: [PATCH 001/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e1fc4ccd41f9 Author: RickyChien Desc: Merge pull request #26470 from RickyChien/bug-1101942 Bug 1101942 - add search path found in nightly ftp package r=me ======== https://hg.mozilla.org/integration/gaia-central/rev/814e0cef09af Author: Ricky Chien Desc: Bug 1101942 - add search path found in nightly ftp package --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 326f3c0c7420..15f0b4c498db 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "769491b138582de92f5636413928de13268e1a63", + "revision": "e1fc4ccd41f96f10c18780af009405c66ad5eb55", "repo_path": "integration/gaia-central" } From 20eaef3bdce486b211710a0cb9ad03b932d30ce3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 01:51:34 -0800 Subject: [PATCH 002/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 5ec71dbee8d4..8cdb02ed3272 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9bb555dff0fb..923b2c34c7db 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 7a322faf010e..ecd362b3d616 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index ef8a12d8ffc4..22f60553c451 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9bb555dff0fb..923b2c34c7db 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 2f7b970251cd..e65c6f8f0b7d 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a65bd7b1011b..538842545bb5 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b113268a20a6..dead540b4041 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index e7f051461288..68261569d36e 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 093bebf99407..c894bfa83360 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 12ecd390d69d..e810f91bb551 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From d3b10d25f2e69cd069a5f46d4ab269f9744ad979 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:01:57 -0800 Subject: [PATCH 003/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c134a25271dd Author: Rex KM Lee Desc: Merge pull request #26399 from rexboy7/1060250-DLNA-player Bug 1060250 - [Stingray][DLNA-player] Initial commit. r=evelyn f=sc ======== https://hg.mozilla.org/integration/gaia-central/rev/a1bd50ad1ea6 Author: Rex Lee Desc: Bug 1060250 - [Stingray][DLNA-player] Initial commit. This version implements: - Detecting dlna services around - ContentDirectory client - AVTransport client - ConnectionService client - Easy UI for local playing files - ssdp.js library - plug.play.js library --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 15f0b4c498db..599fc466a401 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e1fc4ccd41f96f10c18780af009405c66ad5eb55", + "revision": "c134a25271dd5fb604a1957d19cdbf51cdb9312d", "repo_path": "integration/gaia-central" } From 060afa85c665705902794327a9b8c31d1239483c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:07:01 -0800 Subject: [PATCH 004/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8cdb02ed3272..0b3080193f94 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 923b2c34c7db..78b958e94a90 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ecd362b3d616..27bed82e7418 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 22f60553c451..2450f658e97c 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 923b2c34c7db..78b958e94a90 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index e65c6f8f0b7d..e7a9c071f650 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 538842545bb5..9b231f4143c3 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index dead540b4041..57be3d5e2886 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 68261569d36e..db9877de914c 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index c894bfa83360..4eebd6b2669d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index e810f91bb551..54bf10e8af28 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 8239746200d12600a9ac02f6ab84968aa4bd2ecb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:17:01 -0800 Subject: [PATCH 005/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e02a9641ec6d Author: Yoshi Huang Desc: Merge pull request #26404 from allstarschh/Bug1103730 Bug 1103730 - use peer in nfc-manager-tech-discovered. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/8f1c62bfda34 Author: Yoshi Huang Desc: Bug 1103730 - use peer in nfc-manager-tech-discovered. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/c43a5bd74c1d Author: Yoshi Huang Desc: Merge pull request #26403 from allstarschh/Bug1103729 Bug 1103729 - use peer in nfc-manager-send-file. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/ec16b8ca6ff0 Author: Yoshi Huang Desc: Bug 1103729 - use peer in nfc-manager-send-file. r=alive --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 599fc466a401..c85706809d5d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c134a25271dd5fb604a1957d19cdbf51cdb9312d", + "revision": "e02a9641ec6db339f592359be0e8974db2e9b7a0", "repo_path": "integration/gaia-central" } From c703a1c18491f9dbb8432f0d89b60aa17d06f3e7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:21:35 -0800 Subject: [PATCH 006/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 0b3080193f94..c32dad5f0410 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 78b958e94a90..90711dc619e2 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 27bed82e7418..0d5b315ef6be 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 2450f658e97c..dcb18068b101 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 78b958e94a90..90711dc619e2 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index e7a9c071f650..d9a830389b4f 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 9b231f4143c3..d0cd18bd3f72 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 57be3d5e2886..257cae118e91 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index db9877de914c..261a8f6e18a9 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 4eebd6b2669d..bb19e8cb1dbb 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 54bf10e8af28..b2959b81060f 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 172c71cdf990e8e987296c68c87578b917475adf Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Tue, 28 Oct 2014 15:23:44 +0800 Subject: [PATCH 007/121] Bug 1084233 - Part 1: Introduce head.js and rewrite test_icc_card_lock.js with Promise. r=hsinyi --HG-- rename : dom/icc/tests/marionette/test_icc_card_lock.js => dom/icc/tests/marionette/test_icc_card_lock_change_pin.js --- dom/icc/tests/marionette/head.js | 194 ++++++++++++++++++ dom/icc/tests/marionette/manifest.ini | 3 +- .../tests/marionette/test_icc_card_lock.js | 126 ------------ .../test_icc_card_lock_change_pin.js | 45 ++++ .../test_icc_card_lock_get_retry_count.js | 41 ++++ 5 files changed, 282 insertions(+), 127 deletions(-) create mode 100644 dom/icc/tests/marionette/head.js delete mode 100644 dom/icc/tests/marionette/test_icc_card_lock.js create mode 100644 dom/icc/tests/marionette/test_icc_card_lock_change_pin.js create mode 100644 dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js diff --git a/dom/icc/tests/marionette/head.js b/dom/icc/tests/marionette/head.js new file mode 100644 index 000000000000..53e9a02d5f3f --- /dev/null +++ b/dom/icc/tests/marionette/head.js @@ -0,0 +1,194 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; + +const PREF_KEY_RIL_DEBUGGING_ENABLED = "ril.debugging.enabled"; + +// The pin code hard coded in emulator is "0000". +const DEFAULT_PIN = "0000"; + +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} + +let _pendingEmulatorCmdCount = 0; + +/** + * Send emulator command with safe guard. + * + * We should only call |finish()| after all emulator command transactions + * end, so here comes with the pending counter. Resolve when the emulator + * gives positive response, and reject otherwise. + * + * Fulfill params: + * result -- an array of emulator response lines. + * Reject params: + * result -- an array of emulator response lines. + * + * @param aCommand + * A string command to be passed to emulator through its telnet console. + * + * @return A deferred promise. + */ +function runEmulatorCmdSafe(aCommand) { + let deferred = Promise.defer(); + + ++_pendingEmulatorCmdCount; + runEmulatorCmd(aCommand, function(aResult) { + --_pendingEmulatorCmdCount; + + ok(true, "Emulator response: " + JSON.stringify(aResult)); + if (Array.isArray(aResult) && + aResult[aResult.length - 1] === "OK") { + deferred.resolve(aResult); + } else { + deferred.reject(aResult); + } + }); + + return deferred.promise; +} + +let workingFrame; +let iccManager; + +/** + * Push required permissions and test if + * |navigator.mozIccManager| exists. Resolve if it does, + * reject otherwise. + * + * Fulfill params: + * iccManager -- an reference to navigator.mozIccManager. + * + * Reject params: (none) + * + * @param aAdditonalPermissions [optional] + * An array of permission strings other than "mobileconnection" to be + * pushed. Default: empty string. + * + * @return A deferred promise. + */ +function ensureIccManager(aAdditionalPermissions) { + let deferred = Promise.defer(); + + aAdditionalPermissions = aAdditionalPermissions || []; + + if (aAdditionalPermissions.indexOf("mobileconnection") < 0) { + aAdditionalPermissions.push("mobileconnection"); + } + let permissions = []; + for (let perm of aAdditionalPermissions) { + permissions.push({ "type": perm, "allow": 1, "context": document }); + } + + SpecialPowers.pushPermissions(permissions, function() { + ok(true, "permissions pushed: " + JSON.stringify(permissions)); + + // Permission changes can't change existing Navigator.prototype + // objects, so grab our objects from a new Navigator. + workingFrame = document.createElement("iframe"); + workingFrame.addEventListener("load", function load() { + workingFrame.removeEventListener("load", load); + + iccManager = workingFrame.contentWindow.navigator.mozIccManager; + + if (iccManager) { + ok(true, "navigator.mozIccManager is instance of " + iccManager.constructor); + } else { + ok(true, "navigator.mozIccManager is undefined"); + } + + if (iccManager instanceof MozIccManager) { + deferred.resolve(iccManager); + } else { + deferred.reject(); + } + }); + + document.body.appendChild(workingFrame); + }); + + return deferred.promise; +} + +/** + * Get MozIcc by IccId + * + * @param aIccId [optional] + * Default: The first item of |aIccManager.iccIds|. + * + * @return A MozIcc. + */ +function getMozIcc(aIccId) { + aIccId = aIccId || iccManager.iccIds[0]; + + if (!aIccId) { + ok(true, "iccManager.iccIds[0] is undefined"); + return null; + } + + return iccManager.getIccById(aIccId); +} + +/** + * Wait for pending emulator transactions and call |finish()|. + */ +function cleanUp() { + // Use ok here so that we have at least one test run. + ok(true, ":: CLEANING UP ::"); + + waitFor(finish, function() { + return _pendingEmulatorCmdCount === 0; + }); +} + +/** + * Basic test routine helper for icc tests. + * + * This helper does nothing but clean-ups. + * + * @param aTestCaseMain + * A function that takes no parameter. + */ +function startTestBase(aTestCaseMain) { + // Turn on debugging pref. + let debugPref = SpecialPowers.getBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED); + SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, true); + + Promise.resolve() + .then(aTestCaseMain) + .catch((aError) => { + ok(false, "promise rejects during test: " + aError); + }) + .then(() => { + // Restore debugging pref. + SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, debugPref); + cleanUp(); + }); +} + +/** + * Common test routine helper for icc tests. + * + * This function ensures global variable |iccManager| and |icc| is available + * during the process and performs clean-ups as well. + * + * @param aTestCaseMain + * A function that takes one parameter -- icc. + * @param aAdditonalPermissions [optional] + * An array of permission strings other than "mobileconnection" to be + * pushed. Default: empty string.. + */ +function startTestCommon(aTestCaseMain, aAdditionalPermissions) { + startTestBase(function() { + return ensureIccManager(aAdditionalPermissions) + .then(aTestCaseMain); + }); +} diff --git a/dom/icc/tests/marionette/manifest.ini b/dom/icc/tests/marionette/manifest.ini index fd31815dd4af..526564464a67 100644 --- a/dom/icc/tests/marionette/manifest.ini +++ b/dom/icc/tests/marionette/manifest.ini @@ -5,7 +5,8 @@ qemu = true [test_stk_proactive_command.js] [test_icc_contact.js] -[test_icc_card_lock.js] +[test_icc_card_lock_get_retry_count.js] +[test_icc_card_lock_change_pin.js] [test_icc_card_state.js] [test_icc_info.js] [test_stk_refresh.js] diff --git a/dom/icc/tests/marionette/test_icc_card_lock.js b/dom/icc/tests/marionette/test_icc_card_lock.js deleted file mode 100644 index 0c16e381b2ef..000000000000 --- a/dom/icc/tests/marionette/test_icc_card_lock.js +++ /dev/null @@ -1,126 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -MARIONETTE_TIMEOUT = 30000; -MARIONETTE_HEAD_JS = "icc_header.js"; - -/* Test PIN code changes fail */ -taskHelper.push(function testPinChangeFailed() { - // The default pin is '0000' in emulator - let request = icc.setCardLock( - {lockType: "pin", - pin: "1111", - newPin: "0000"}); - - ok(request instanceof DOMRequest, - "request instanceof " + request.constructor); - - request.onerror = function onerror() { - is(request.error.name, "IncorrectPassword"); - // The default pin retries is 3, failed once becomes to 2 - is(request.error.retryCount, 2); - - // Reset pin retries by passing correct pin code. - let resetRequest = icc.setCardLock( - {lockType: "pin", - pin: "0000", - newPin: "0000"}); - - resetRequest.onsuccess = function onsuccess() { - taskHelper.runNext(); - }; - - resetRequest.onerror = function onerror() { - ok(false, "Reset pin retries got error: " + request.error.name); - taskHelper.runNext(); - }; - }; -}); - -/* Test PIN code changes success */ -taskHelper.push(function testPinChangeSuccess() { - // The default pin is '0000' in emulator - let request = icc.setCardLock( - {lockType: "pin", - pin: "0000", - newPin: "0000"}); - - ok(request instanceof DOMRequest, - "request instanceof " + request.constructor); - - request.onerror = function onerror() { - ok(false, "Should not fail, got error: " + request.error.name); - - taskHelper.runNext(); - }; - - request.onsuccess = function onsuccess() { - taskHelper.runNext(); - }; -}); - -/* Read PIN-lock retry count */ -taskHelper.push(function testPinCardLockRetryCount() { - let request = icc.getCardLockRetryCount('pin'); - - ok(request instanceof DOMRequest, - 'request instanceof ' + request.constructor); - - request.onsuccess = function onsuccess() { - ok(request.result.retryCount >= 0, - 'retryCount is ' + request.result.retryCount); - taskHelper.runNext(); - }; - request.onerror = function onerror() { - // The operation is optional any might not be supported for all - // all locks. In this case, we generate 'NotSupportedError' for - // the valid lock types. - is(request.error.name, 'RequestNotSupported', - 'error name is ' + request.error.name); - taskHelper.runNext(); - }; -}); - -/* Read PUK-lock retry count */ -taskHelper.push(function testPukCardLockRetryCount() { - let request = icc.getCardLockRetryCount('puk'); - - ok(request instanceof DOMRequest, - 'request instanceof ' + request.constructor); - - request.onsuccess = function onsuccess() { - ok(request.result.retryCount >= 0, - 'retryCount is ' + request.result.retryCount); - taskHelper.runNext(); - }; - request.onerror = function onerror() { - // The operation is optional any might not be supported for all - // all locks. In this case, we generate 'NotSupportedError' for - // the valid lock types. - is(request.error.name, 'RequestNotSupported', - 'error name is ' + request.error.name); - taskHelper.runNext(); - }; -}); - -/* Read lock retry count for an invalid entries */ -taskHelper.push(function testInvalidCardLockRetryCount() { - let request = icc.getCardLockRetryCount('invalid-lock-type'); - - ok(request instanceof DOMRequest, - 'request instanceof ' + request.constructor); - - request.onsuccess = function onsuccess() { - ok(false, - 'request should never return success for an invalid lock type'); - taskHelper.runNext(); - }; - request.onerror = function onerror() { - is(request.error.name, 'GenericFailure', - 'error name is ' + request.error.name); - taskHelper.runNext(); - }; -}); - -// Start test -taskHelper.runNext(); diff --git a/dom/icc/tests/marionette/test_icc_card_lock_change_pin.js b/dom/icc/tests/marionette/test_icc_card_lock_change_pin.js new file mode 100644 index 000000000000..07a8c5a7a4e2 --- /dev/null +++ b/dom/icc/tests/marionette/test_icc_card_lock_change_pin.js @@ -0,0 +1,45 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +const LOCK_TYPE = "pin"; + +function testChangePin(aIcc, aPin, aNewPin, aErrorName, aRetryCount) { + log("testChangePin for pin=" + aPin + " and newPin=" + aNewPin); + return aIcc.setCardLock({ lockType: LOCK_TYPE, pin: aPin, newPin: aNewPin }) + .then((aResult) => { + if (aErrorName) { + ok(false, "changing pin should not success"); + } + }, (aError) => { + if (!aErrorName) { + ok(false, "changing pin should not fail"); + return; + } + + // check the request error. + is(aError.name, aErrorName, "error.name"); + is(aError.retryCount, aRetryCount, "error.retryCount"); + }); +} + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + let retryCount; + + return icc.getCardLockRetryCount(LOCK_TYPE) + // Get current PIN-lock retry count. + .then((aResult) => { + retryCount = aResult.retryCount; + ok(true, LOCK_TYPE + " retryCount is " + retryCount); + }) + // Test PIN code changes fail. + // The retry count should be decreased by 1. + .then(() => testChangePin(icc, "1111", DEFAULT_PIN, "IncorrectPassword", + retryCount - 1)) + // Test PIN code changes success. This will reset the retry count. + .then(() => testChangePin(icc, DEFAULT_PIN, DEFAULT_PIN)); +}); diff --git a/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js b/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js new file mode 100644 index 000000000000..25b9ef7874ba --- /dev/null +++ b/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function testGetCardLockRetryCount(aIcc, aLockType, aRetryCount) { + log("testGetCardLockRetryCount for " + aLockType); + return aIcc.getCardLockRetryCount(aLockType) + .then((aResult) => { + if (!aRetryCount) { + ok(false, "getCardLockRetryCount(" + aLockType + ") should not success"); + return; + } + + // Check the request result. + is(aResult.retryCount, aRetryCount, "result.retryCount"); + }, (aError) => { + if (aRetryCount) { + ok(false, "getCardLockRetryCount(" + aLockType + ") should not fail"); + return; + } + + // Check the error. + is(aError.name, "GenericFailure", "error.name"); + }); +} + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + + // Read PIN-lock retry count. + // The default PIN-lock retry count hard coded in emulator is 3. + return testGetCardLockRetryCount(icc, "pin", 3) + // Read PUK-lock retry count. + // The default PUK-lock retry count hard coded in emulator is 6. + .then(() => testGetCardLockRetryCount(icc, "puk", 6)) + // Read lock retry count for an invalid entries. + .then(() => testGetCardLockRetryCount(icc, "invalid-lock-type")); +}); From c8afe03d1a93fe3c2d97a0399c0f217b0a5606d2 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Sun, 26 Oct 2014 15:25:37 +0800 Subject: [PATCH 008/121] Bug 1084233 - Part 2: Add marionette test for enabling/disabling pin lock. r=hsinyi --- dom/icc/tests/marionette/manifest.ini | 1 + .../test_icc_card_lock_enable_pin.js | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 dom/icc/tests/marionette/test_icc_card_lock_enable_pin.js diff --git a/dom/icc/tests/marionette/manifest.ini b/dom/icc/tests/marionette/manifest.ini index 526564464a67..a0acdf2c55dd 100644 --- a/dom/icc/tests/marionette/manifest.ini +++ b/dom/icc/tests/marionette/manifest.ini @@ -7,6 +7,7 @@ qemu = true [test_icc_contact.js] [test_icc_card_lock_get_retry_count.js] [test_icc_card_lock_change_pin.js] +[test_icc_card_lock_enable_pin.js] [test_icc_card_state.js] [test_icc_info.js] [test_stk_refresh.js] diff --git a/dom/icc/tests/marionette/test_icc_card_lock_enable_pin.js b/dom/icc/tests/marionette/test_icc_card_lock_enable_pin.js new file mode 100644 index 000000000000..ea21821c0f2a --- /dev/null +++ b/dom/icc/tests/marionette/test_icc_card_lock_enable_pin.js @@ -0,0 +1,59 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function setCardLockAndCheck(aIcc, aLockType, aPin, aEnabled, aErrorName, + aRetryCount) { + let options = { + lockType: aLockType, + enabled: aEnabled, + pin: aPin + }; + + return aIcc.setCardLock(options) + .then((aResult) => { + if (aErrorName) { + ok(false, "setting pin should not success"); + return; + } + + // Check lock state. + return aIcc.getCardLock(aLockType) + .then((aResult) => { + is(aResult.enabled, aEnabled, "result.enabled"); + }); + }, (aError) => { + if (!aErrorName) { + ok(false, "setting pin should not fail"); + return; + } + + // Check the request error. + is(aError.name, aErrorName, "error.name"); + is(aError.retryCount, aRetryCount, "error.retryCount"); + }); +} + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + let lockType = "pin"; + let retryCount; + + return icc.getCardLockRetryCount(lockType) + // Get current PIN-lock retry count. + .then((aResult) => { + retryCount = aResult.retryCount; + ok(true, lockType + " retryCount is " + retryCount); + }) + // Test fail to enable PIN-lock by passing wrong pin. + // The retry count should be decreased by 1. + .then(() => setCardLockAndCheck(icc, lockType, "1111", true, + "IncorrectPassword", retryCount -1)) + // Test enabling PIN-lock. + .then(() => setCardLockAndCheck(icc, lockType, DEFAULT_PIN, true)) + // Restore pin state. + .then(() => setCardLockAndCheck(icc, lockType, DEFAULT_PIN, false)); +}); From 1896c8b71e94dbca7520ebd9010808dc1a065b82 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Mon, 27 Oct 2014 11:10:35 +0800 Subject: [PATCH 009/121] Bug 1084233 - Part 3: Add marionette test for unlocking pin. r=hsinyi --- dom/icc/tests/marionette/head.js | 152 ++++++++++++++++++ dom/icc/tests/marionette/manifest.ini | 1 + .../test_icc_card_lock_unlock_pin.js | 68 ++++++++ 3 files changed, 221 insertions(+) create mode 100644 dom/icc/tests/marionette/test_icc_card_lock_unlock_pin.js diff --git a/dom/icc/tests/marionette/head.js b/dom/icc/tests/marionette/head.js index 53e9a02d5f3f..c4e2692d1daa 100644 --- a/dom/icc/tests/marionette/head.js +++ b/dom/icc/tests/marionette/head.js @@ -137,6 +137,158 @@ function getMozIcc(aIccId) { return iccManager.getIccById(aIccId); } +/** + * Get MozMobileConnection by ServiceId + * + * @param aServiceId [optional] + * A numeric DSDS service id. Default: 0 if not indicated. + * + * @return A MozMobileConnection. + */ +function getMozMobileConnectionByServiceId(aServiceId) { + aServiceId = aServiceId || 0; + return workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId]; +} + +/** + * Set radio enabling state. + * + * Resolve no matter the request succeeds or fails. Never reject. + * + * Fulfill params: (none) + * + * @param aEnabled + * A boolean state. + * @param aServiceId [optional] + * A numeric DSDS service id. + * + * @return A deferred promise. + */ +function setRadioEnabled(aEnabled, aServiceId) { + return getMozMobileConnectionByServiceId(aServiceId).setRadioEnabled(aEnabled) + .then(() => { + ok(true, "setRadioEnabled " + aEnabled + " on " + aServiceId + " success."); + }, (aError) => { + ok(false, "setRadioEnabled " + aEnabled + " on " + aServiceId + " " + + aError.name); + }); +} + +/** + * Wait for one named event. + * + * Resolve if that named event occurs. Never reject. + * + * Fulfill params: the DOMEvent passed. + * + * @param aEventTarget + * An EventTarget object. + * @param aEventName + * A string event name. + * @param aMatchFun [optional] + * A matching function returns true or false to filter the event. + * + * @return A deferred promise. + */ +function waitForTargetEvent(aEventTarget, aEventName, aMatchFun) { + let deferred = Promise.defer(); + + aEventTarget.addEventListener(aEventName, function onevent(aEvent) { + if (!aMatchFun || aMatchFun(aEvent)) { + aEventTarget.removeEventListener(aEventName, onevent); + ok(true, "Event '" + aEventName + "' got."); + deferred.resolve(aEvent); + } + }); + + return deferred.promise; +} + +/** + * Set radio enabling state and wait for "radiostatechange" event. + * + * Resolve if radio state changed to the expected one. Never reject. + * + * Fulfill params: (none) + * + * @param aEnabled + * A boolean state. + * @param aServiceId [optional] + * A numeric DSDS service id. Default: the one indicated in + * start*TestCommon() or 0 if not indicated. + * + * @return A deferred promise. + */ +function setRadioEnabledAndWait(aEnabled, aServiceId) { + let mobileConn = getMozMobileConnectionByServiceId(aServiceId); + let promises = []; + + promises.push(waitForTargetEvent(mobileConn, "radiostatechange", function() { + // To ignore some transient states, we only resolve that deferred promise + // when |radioState| equals to the expected one. + return mobileConn.radioState === (aEnabled ? "enabled" : "disabled"); + })); + promises.push(setRadioEnabled(aEnabled, aServiceId)); + + return Promise.all(promises); +} + +/** + * Restart radio and wait card state changes to expected one. + * + * Resolve if card state changed to the expected one. Never reject. + * + * Fulfill params: (none) + * + * @param aCardState + * Expected card state. + * + * @return A deferred promise. + */ +function restartRadioAndWait(aCardState) { + return setRadioEnabledAndWait(false).then(() => { + let promises = []; + + promises.push(waitForTargetEvent(iccManager, "iccdetected") + .then((aEvent) => { + let icc = getMozIcc(aEvent.iccId); + if (icc.cardState !== aCardState) { + return waitForTargetEvent(icc, "cardstatechange", function() { + return icc.cardState === aCardState; + }); + } + })); + promises.push(setRadioEnabledAndWait(true)); + + return Promise.all(promises); + }); +} + +/** + * Enable/Disable PIN-lock. + * + * Fulfill params: (none) + * Reject params: + * An object contains error name and remaining retry count. + * @see IccCardLockError + * + * @param aIcc + * A MozIcc object. + * @param aEnabled + * A boolean state. + * + * @return A deferred promise. + */ +function setPinLockEnabled(aIcc, aEnabled) { + let options = { + lockType: "pin", + enabled: aEnabled, + pin: DEFAULT_PIN + }; + + return aIcc.setCardLock(options); +} + /** * Wait for pending emulator transactions and call |finish()|. */ diff --git a/dom/icc/tests/marionette/manifest.ini b/dom/icc/tests/marionette/manifest.ini index a0acdf2c55dd..251223b6ea6c 100644 --- a/dom/icc/tests/marionette/manifest.ini +++ b/dom/icc/tests/marionette/manifest.ini @@ -8,6 +8,7 @@ qemu = true [test_icc_card_lock_get_retry_count.js] [test_icc_card_lock_change_pin.js] [test_icc_card_lock_enable_pin.js] +[test_icc_card_lock_unlock_pin.js] [test_icc_card_state.js] [test_icc_info.js] [test_stk_refresh.js] diff --git a/dom/icc/tests/marionette/test_icc_card_lock_unlock_pin.js b/dom/icc/tests/marionette/test_icc_card_lock_unlock_pin.js new file mode 100644 index 000000000000..83e2eb2a718f --- /dev/null +++ b/dom/icc/tests/marionette/test_icc_card_lock_unlock_pin.js @@ -0,0 +1,68 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function testUnlockPin(aIcc, aPin, aErrorName, aRetryCount) { + log("testUnlockPin with pin=" + aPin); + + return aIcc.unlockCardLock({ lockType: "pin", pin: aPin }) + .then((aResult) => { + if (aErrorName) { + ok(false, "unlocking pin should not success"); + } + }, (aError) => { + if (!aErrorName) { + ok(false, "unlocking pin should not fail"); + return; + } + + // Check the request error. + is(aError.name, aErrorName, "error.name"); + is(aError.retryCount, aRetryCount, "error.retryCount"); + }); +} + +function testUnlockPinAndWait(aIcc, aPin, aCardState) { + log("testUnlockPin with pin=" + aPin + ", and wait cardState changes to '" + + aCardState + "'"); + + let promises = []; + + promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() { + return aIcc.cardState === aCardState; + })); + promises.push(testUnlockPin(aIcc, aPin)); + + return Promise.all(promises); +} + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + let retryCount; + + // Enable PIN-lock. + return setPinLockEnabled(icc, true) + // Reset card state to "pinRequired" by restarting radio + .then(() => restartRadioAndWait("pinRequired")) + .then(() => { icc = getMozIcc(); }) + + // Get current PIN-lock retry count. + .then(() => icc.getCardLockRetryCount("pin")) + .then((aResult) => { + retryCount = aResult.retryCount; + ok(true, "pin retryCount is " + retryCount); + }) + + // Test fail to unlock PIN-lock. + // The retry count should be decreased by 1. + .then(() => testUnlockPin(icc, "1111", "IncorrectPassword", retryCount - 1)) + + // Test success to unlock PIN-lock. + .then(() => testUnlockPinAndWait(icc, DEFAULT_PIN, "ready")) + + // Restore pin state. + .then(() => setPinLockEnabled(icc, false)); +}); From 2f7098b238fb7d50482eb68f6cd8ebef59544c8c Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Mon, 27 Oct 2014 16:14:46 +0800 Subject: [PATCH 010/121] Bug 1084233 - Part 4: Add marionette test for unlocking puk. r=hsinyi --- dom/icc/tests/marionette/head.js | 2 + dom/icc/tests/marionette/manifest.ini | 1 + .../test_icc_card_lock_unlock_puk.js | 97 +++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 dom/icc/tests/marionette/test_icc_card_lock_unlock_puk.js diff --git a/dom/icc/tests/marionette/head.js b/dom/icc/tests/marionette/head.js index c4e2692d1daa..c34d1c58ce6b 100644 --- a/dom/icc/tests/marionette/head.js +++ b/dom/icc/tests/marionette/head.js @@ -7,6 +7,8 @@ const PREF_KEY_RIL_DEBUGGING_ENABLED = "ril.debugging.enabled"; // The pin code hard coded in emulator is "0000". const DEFAULT_PIN = "0000"; +// The puk code hard coded in emulator is "12345678". +const DEFAULT_PUK = "12345678"; // Emulate Promise.jsm semantics. Promise.defer = function() { return new Deferred(); } diff --git a/dom/icc/tests/marionette/manifest.ini b/dom/icc/tests/marionette/manifest.ini index 251223b6ea6c..4dfdff005b63 100644 --- a/dom/icc/tests/marionette/manifest.ini +++ b/dom/icc/tests/marionette/manifest.ini @@ -9,6 +9,7 @@ qemu = true [test_icc_card_lock_change_pin.js] [test_icc_card_lock_enable_pin.js] [test_icc_card_lock_unlock_pin.js] +[test_icc_card_lock_unlock_puk.js] [test_icc_card_state.js] [test_icc_info.js] [test_stk_refresh.js] diff --git a/dom/icc/tests/marionette/test_icc_card_lock_unlock_puk.js b/dom/icc/tests/marionette/test_icc_card_lock_unlock_puk.js new file mode 100644 index 000000000000..71b9b1c4400e --- /dev/null +++ b/dom/icc/tests/marionette/test_icc_card_lock_unlock_puk.js @@ -0,0 +1,97 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function passingWrongPinAndWait(aIcc) { + return aIcc.getCardLockRetryCount("pin").then((aResult) => { + let promises = []; + let retryCount = aResult.retryCount; + + ok(true, "pin retryCount is " + retryCount); + + promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() { + return aIcc.cardState === "pukRequired"; + })); + + for (let i = 0; i < retryCount; i++) { + promises.push(aIcc.unlockCardLock({ lockType: "pin", pin: "1111" }) + .then(() => { + ok(false, "unlocking pin should not success"); + }, function reject(aRetryCount, aError) { + // check the request error. + is(aError.name, "IncorrectPassword", "error.name"); + is(aError.retryCount, aRetryCount, "error.retryCount"); + }.bind(null, retryCount - i - 1))); + } + + return Promise.all(promises); + }); +} + +function testUnlockPuk(aIcc, aPuk, aNewPin, aErrorName, aRetryCount) { + log("testUnlockPuk with puk=" + aPuk + " and newPin=" + aNewPin); + + return aIcc.unlockCardLock({ lockType: "puk", puk: aPuk, newPin: aNewPin }) + .then((aResult) => { + if (aErrorName) { + ok(false, "unlocking puk should not success"); + } + }, (aError) => { + if (!aErrorName) { + ok(false, "unlocking puk should not fail"); + return; + } + + // Check the request error. + is(aError.name, aErrorName, "error.name"); + is(aError.retryCount, aRetryCount, "error.retryCount"); + }); +} + +function testUnlockPukAndWait(aIcc, aPuk, aNewPin, aCardState) { + log("testUnlockPuk with puk=" + aPuk + "/newPin=" + aNewPin + + ", and wait card state changes to '" + aCardState + "'"); + + let promises = []; + + promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() { + return aIcc.cardState === aCardState; + })); + promises.push(testUnlockPuk(aIcc, aPuk, aNewPin)); + + return Promise.all(promises); +} + +// Start tests +startTestCommon(function() { + let icc = getMozIcc(); + let retryCount; + + // Enable pin lock. + return setPinLockEnabled(icc, true) + // Reset card state to "pinRequired" by restarting radio + .then(() => restartRadioAndWait("pinRequired")) + .then(() => { icc = getMozIcc() }) + // Switch cardState to "pukRequired" by entering wrong pin code. + .then(() => passingWrongPinAndWait(icc)) + + // Get current PUK-lock retry count. + .then(() => icc.getCardLockRetryCount("puk")) + .then((aResult) => { + retryCount = aResult.retryCount; + ok(true, "puk retryCount is " + retryCount); + }) + + // Test unlock PUK code fail. + // The retry count should be decreased by 1. + .then(() => testUnlockPuk(icc, "11111111", DEFAULT_PIN, "IncorrectPassword", + retryCount - 1)) + + // Test unlock PUK code success. + .then(() => testUnlockPukAndWait(icc, DEFAULT_PUK, DEFAULT_PIN, "ready")) + + // Restore pin state. + .then(() => setPinLockEnabled(icc, false)); +}); From 747f7c15d0592256e1688806c8b18b03f0dd74bf Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Tue, 25 Nov 2014 15:01:33 -0800 Subject: [PATCH 011/121] Bug 1093098 - Don't get native stack before libs are loaded; r=snorp --- mobile/android/base/ANRReporter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/ANRReporter.java b/mobile/android/base/ANRReporter.java index d1a0053c87d2..cc84a51437c6 100644 --- a/mobile/android/base/ANRReporter.java +++ b/mobile/android/base/ANRReporter.java @@ -471,9 +471,12 @@ public final class ANRReporter extends BroadcastReceiver private static void processTraces(Reader traces, File pingFile) { - // Unwinding is memory intensive; only unwind if we have enough memory - boolean haveNativeStack = requestNativeStack( - /* unwind */ SysInfo.getMemSize() >= 640); + // Only get native stack if Gecko is running. + // Also, unwinding is memory intensive, so only unwind if we have enough memory. + final boolean haveNativeStack = + GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning) ? + requestNativeStack(/* unwind */ SysInfo.getMemSize() >= 640) : false; + try { OutputStream ping = new BufferedOutputStream( new FileOutputStream(pingFile), TRACES_BLOCK_SIZE); From e95f778e74b9336df80d656e959d45cf94ee4e2e Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Tue, 25 Nov 2014 15:02:32 -0800 Subject: [PATCH 012/121] Bug 1101031 - Report UpdateService crashes; r=snorp --- mobile/android/base/CrashHandler.java | 30 +++++++++++++++++-- .../android/base/updater/UpdateService.java | 11 +++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/CrashHandler.java b/mobile/android/base/CrashHandler.java index cd618b18fb6d..950d70f8c6ac 100644 --- a/mobile/android/base/CrashHandler.java +++ b/mobile/android/base/CrashHandler.java @@ -27,7 +27,7 @@ import android.os.Bundle; import android.os.Process; import android.util.Log; -class CrashHandler implements Thread.UncaughtExceptionHandler { +public class CrashHandler implements Thread.UncaughtExceptionHandler { private static final String LOGTAG = "GeckoCrashHandler"; private static final Thread MAIN_THREAD = Thread.currentThread(); @@ -234,7 +234,7 @@ class CrashHandler implements Thread.UncaughtExceptionHandler { final PackageInfo pkgInfo = pkgMgr.getPackageInfo(pkgName, 0); extras.putString("Version", pkgInfo.versionName); extras.putInt("BuildID", pkgInfo.versionCode); - extras.putLong("InstallTime", pkgInfo.firstInstallTime / 1000); + extras.putLong("InstallTime", pkgInfo.lastUpdateTime / 1000); } catch (final PackageManager.NameNotFoundException e) { Log.i(LOGTAG, "Error getting package info", e); } @@ -439,4 +439,30 @@ class CrashHandler implements Thread.UncaughtExceptionHandler { terminateProcess(); } } + + public static CrashHandler createDefaultCrashHandler(final Context context) { + return new CrashHandler(context) { + @Override + protected Bundle getCrashExtras(final Thread thread, final Throwable exc) { + final Bundle extras = super.getCrashExtras(thread, exc); + + extras.putString("ProductName", AppConstants.MOZ_APP_BASENAME); + extras.putString("ProductID", AppConstants.MOZ_APP_ID); + extras.putString("Version", AppConstants.MOZ_APP_VERSION); + extras.putString("BuildID", AppConstants.MOZ_APP_BUILDID); + extras.putString("Vendor", AppConstants.MOZ_APP_VENDOR); + extras.putString("ReleaseChannel", AppConstants.MOZ_UPDATE_CHANNEL); + return extras; + } + + @Override + public boolean reportException(final Thread thread, final Throwable exc) { + if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) { + // Only use Java crash reporter if enabled on official build. + return super.reportException(thread, exc); + } + return false; + } + }; + } } diff --git a/mobile/android/base/updater/UpdateService.java b/mobile/android/base/updater/UpdateService.java index c2475c2dc600..229d238e0dd4 100644 --- a/mobile/android/base/updater/UpdateService.java +++ b/mobile/android/base/updater/UpdateService.java @@ -6,6 +6,7 @@ package org.mozilla.gecko.updater; import org.mozilla.gecko.AppConstants; +import org.mozilla.gecko.CrashHandler; import org.mozilla.gecko.R; import org.mozilla.apache.commons.codec.binary.Hex; @@ -80,12 +81,16 @@ public class UpdateService extends IntentService { private boolean mCancelDownload; private boolean mApplyImmediately; + private CrashHandler mCrashHandler; + public UpdateService() { super("updater"); } @Override public void onCreate () { + mCrashHandler = CrashHandler.createDefaultCrashHandler(getApplicationContext()); + super.onCreate(); mPrefs = getSharedPreferences(PREFS_NAME, 0); @@ -94,6 +99,12 @@ public class UpdateService extends IntentService { mCancelDownload = false; } + @Override + public void onDestroy() { + mCrashHandler.unregister(); + mCrashHandler = null; + } + @Override public synchronized int onStartCommand (Intent intent, int flags, int startId) { // If we are busy doing a download, the new Intent here would normally be queued for From 76f45fdfdbca5903048883b563ed1f9fa23b9cb1 Mon Sep 17 00:00:00 2001 From: James Long Date: Tue, 25 Nov 2014 15:02:39 -0800 Subject: [PATCH 013/121] Bug 905700 - use Debugger.Source in the debugger backend and reference source actors instead of URLs in the frontend r=fitzgen --- .../devtools/canvasdebugger/canvasdebugger.js | 5 +- .../browser_canvas-frontend-call-stack-01.js | 2 +- .../browser_canvas-frontend-call-stack-02.js | 2 +- browser/devtools/canvasdebugger/test/head.js | 5 + .../devtools/debugger/debugger-commands.js | 50 +- .../devtools/debugger/debugger-controller.js | 156 +- browser/devtools/debugger/debugger-panes.js | 155 +- browser/devtools/debugger/debugger-toolbar.js | 56 +- browser/devtools/debugger/debugger-view.js | 31 +- browser/devtools/debugger/test/browser.ini | 6 + .../test/browser_dbg_addon-sources.js | 1 + .../debugger/test/browser_dbg_addonactor.js | 9 +- .../test/browser_dbg_auto-pretty-print-01.js | 9 +- .../test/browser_dbg_auto-pretty-print-02.js | 6 +- .../test/browser_dbg_blackboxing-03.js | 6 +- .../test/browser_dbg_blackboxing-04.js | 11 +- .../test/browser_dbg_blackboxing-06.js | 8 +- .../test/browser_dbg_breadcrumbs-access.js | 36 +- ...browser_dbg_breakpoints-actual-location.js | 20 +- ...rowser_dbg_breakpoints-actual-location2.js | 12 +- ...-break-on-last-line-of-script-on-reload.js | 8 +- .../test/browser_dbg_breakpoints-button-01.js | 6 +- .../test/browser_dbg_breakpoints-button-02.js | 10 +- ...browser_dbg_breakpoints-contextmenu-add.js | 4 +- .../browser_dbg_breakpoints-contextmenu.js | 16 +- ...browser_dbg_breakpoints-disabled-reload.js | 10 +- .../test/browser_dbg_breakpoints-editor.js | 28 +- .../test/browser_dbg_breakpoints-eval.js | 46 + .../test/browser_dbg_breakpoints-highlight.js | 18 +- .../browser_dbg_breakpoints-new-script.js | 6 +- .../browser_dbg_breakpoints-other-tabs.js | 2 +- .../test/browser_dbg_breakpoints-pane.js | 10 +- .../test/browser_dbg_breakpoints-reload.js | 4 +- .../debugger/test/browser_dbg_clean-exit.js | 7 +- .../debugger/test/browser_dbg_cmd-break.js | 107 +- .../browser_dbg_conditional-breakpoints-01.js | 42 +- .../browser_dbg_conditional-breakpoints-02.js | 24 +- .../browser_dbg_conditional-breakpoints-03.js | 2 +- .../browser_dbg_conditional-breakpoints-04.js | 2 +- .../browser_dbg_controller-evaluate-01.js | 12 +- .../browser_dbg_controller-evaluate-02.js | 12 +- .../test/browser_dbg_editor-contextmenu.js | 2 +- .../debugger/test/browser_dbg_editor-mode.js | 2 +- .../test/browser_dbg_event-listeners-01.js | 9 +- .../test/browser_dbg_event-listeners-02.js | 2 +- .../debugger/test/browser_dbg_file-reload.js | 4 +- .../debugger/test/browser_dbg_iframes.js | 2 +- .../debugger/test/browser_dbg_interrupts.js | 6 +- .../browser_dbg_location-changes-03-new.js | 2 +- ...wser_dbg_location-changes-04-breakpoint.js | 18 +- .../test/browser_dbg_optimized-out-vars.js | 3 +- .../test/browser_dbg_pretty-print-05.js | 9 +- .../test/browser_dbg_pretty-print-06.js | 4 +- .../test/browser_dbg_pretty-print-08.js | 40 +- .../test/browser_dbg_pretty-print-09.js | 8 +- .../test/browser_dbg_pretty-print-12.js | 4 +- .../browser_dbg_pretty-print-on-paused.js | 7 +- .../browser_dbg_reload-preferred-script-01.js | 7 +- .../browser_dbg_reload-preferred-script-02.js | 6 +- .../browser_dbg_reload-preferred-script-03.js | 8 +- .../test/browser_dbg_reload-same-script.js | 8 +- .../test/browser_dbg_scripts-switching-01.js | 41 +- .../test/browser_dbg_scripts-switching-02.js | 37 +- .../test/browser_dbg_search-basic-02.js | 2 +- .../test/browser_dbg_search-basic-03.js | 2 +- .../test/browser_dbg_search-basic-04.js | 30 +- .../test/browser_dbg_search-global-01.js | 16 +- .../test/browser_dbg_search-global-02.js | 55 +- .../test/browser_dbg_search-global-03.js | 10 +- .../test/browser_dbg_search-global-04.js | 14 +- .../test/browser_dbg_search-global-05.js | 14 +- .../test/browser_dbg_search-global-06.js | 8 +- .../test/browser_dbg_search-popup-jank.js | 1 + .../test/browser_dbg_search-sources-01.js | 4 +- .../test/browser_dbg_search-symbols.js | 12 +- .../browser_dbg_searchbox-help-popup-02.js | 4 +- .../browser_dbg_server-conditional-bp-01.js | 40 +- .../browser_dbg_server-conditional-bp-02.js | 16 +- .../browser_dbg_server-conditional-bp-03.js | 2 +- .../browser_dbg_server-conditional-bp-04.js | 2 +- .../test/browser_dbg_source-maps-01.js | 14 +- .../test/browser_dbg_source-maps-02.js | 12 +- .../test/browser_dbg_source-maps-03.js | 8 +- .../test/browser_dbg_source-maps-04.js | 18 +- .../test/browser_dbg_sources-cache.js | 18 +- .../debugger/test/browser_dbg_sources-eval.js | 41 + .../test/browser_dbg_sources-labels.js | 35 +- .../test/browser_dbg_sources-sorting.js | 31 +- ...browser_dbg_split-console-paused-reload.js | 5 +- .../debugger/test/browser_dbg_stack-02.js | 2 +- .../debugger/test/browser_dbg_stack-05.js | 88 +- .../debugger/test/browser_dbg_stack-06.js | 12 +- .../debugger/test/browser_dbg_stack-07.js | 10 +- .../debugger/test/browser_dbg_tracing-03.js | 12 +- .../browser_dbg_variables-view-reexpand-01.js | 2 +- .../browser_dbg_variables-view-reexpand-02.js | 2 +- .../browser_dbg_variables-view-reexpand-03.js | 2 +- .../debugger/test/code_math_bogus_map.js | 2 +- .../debugger/test/code_script-eval.js | 6 + .../debugger/test/code_script-switching-01.js | 2 +- .../debugger/test/code_script-switching-02.js | 2 +- .../debugger/test/code_test-editor-mode | 2 +- .../devtools/debugger/test/doc_cmd-break.html | 4 +- .../debugger/test/doc_script-eval.html | 17 + .../debugger/test/doc_tracing-01.html | 8 + browser/devtools/debugger/test/head.js | 46 +- .../browser_profiler_jump-to-debugger-01.js | 3 +- .../browser_profiler_jump-to-debugger-02.js | 5 +- browser/devtools/profiler/test/head.js | 5 + browser/devtools/profiler/ui-profile.js | 5 +- browser/devtools/shared/widgets/Tooltip.js | 8 +- browser/devtools/webconsole/hudservice.js | 7 +- .../browser_console_optimized_out_vars.js | 2 +- ...nsole_bug_766001_JS_Console_in_Debugger.js | 4 +- .../test/browser_webconsole_view_source.js | 16 +- browser/devtools/webconsole/test/head.js | 4 + toolkit/devtools/DevToolsUtils.js | 33 +- toolkit/devtools/client/dbg-client.jsm | 168 +- toolkit/devtools/server/actors/root.js | 3 + toolkit/devtools/server/actors/script.js | 1948 ++++++++++------- toolkit/devtools/server/actors/tracer.js | 77 +- .../devtools/server/tests/unit/head_dbg.js | 29 +- .../server/tests/unit/test_blackboxing-01.js | 22 +- .../server/tests/unit/test_blackboxing-02.js | 23 +- .../server/tests/unit/test_blackboxing-03.js | 6 +- .../server/tests/unit/test_blackboxing-04.js | 23 +- .../server/tests/unit/test_blackboxing-06.js | 2 +- .../server/tests/unit/test_breakpoint-01.js | 11 +- .../server/tests/unit/test_breakpoint-02.js | 39 +- .../server/tests/unit/test_breakpoint-03.js | 18 +- .../server/tests/unit/test_breakpoint-04.js | 13 +- .../server/tests/unit/test_breakpoint-05.js | 18 +- .../server/tests/unit/test_breakpoint-06.js | 15 +- .../server/tests/unit/test_breakpoint-07.js | 16 +- .../server/tests/unit/test_breakpoint-08.js | 64 +- .../server/tests/unit/test_breakpoint-09.js | 9 +- .../server/tests/unit/test_breakpoint-10.js | 8 +- .../server/tests/unit/test_breakpoint-11.js | 8 +- .../server/tests/unit/test_breakpoint-12.js | 21 +- .../server/tests/unit/test_breakpoint-13.js | 7 +- .../server/tests/unit/test_breakpoint-14.js | 7 +- .../server/tests/unit/test_breakpoint-15.js | 15 +- .../server/tests/unit/test_breakpoint-16.js | 28 +- .../server/tests/unit/test_breakpoint-17.js | 15 +- .../server/tests/unit/test_breakpoint-18.js | 20 +- .../server/tests/unit/test_breakpoint-19.js | 9 +- .../server/tests/unit/test_breakpoint-20.js | 6 +- .../server/tests/unit/test_breakpointstore.js | 46 +- .../unit/test_conditional_breakpoint-01.js | 4 +- .../unit/test_conditional_breakpoint-02.js | 30 +- .../unit/test_conditional_breakpoint-03.js | 4 +- .../test_get-executable-lines-source-map.js | 2 +- .../server/tests/unit/test_listsources-01.js | 11 +- .../server/tests/unit/test_new_source-01.js | 4 +- .../server/tests/unit/test_objectgrips-13.js | 12 +- .../server/tests/unit/test_sourcemaps-02.js | 2 +- .../server/tests/unit/test_sourcemaps-03.js | 71 +- .../server/tests/unit/test_sourcemaps-06.js | 35 +- .../server/tests/unit/test_sourcemaps-09.js | 13 +- .../server/tests/unit/test_sourcemaps-10.js | 4 +- .../server/tests/unit/test_sourcemaps-11.js | 4 +- .../server/tests/unit/test_sourcemaps-12.js | 4 +- .../server/tests/unit/test_sourcemaps-13.js | 2 + .../devtools/server/tests/unit/xpcshell.ini | 2 + 164 files changed, 2840 insertions(+), 1974 deletions(-) create mode 100644 browser/devtools/debugger/test/browser_dbg_breakpoints-eval.js create mode 100644 browser/devtools/debugger/test/browser_dbg_sources-eval.js create mode 100644 browser/devtools/debugger/test/code_script-eval.js create mode 100644 browser/devtools/debugger/test/doc_script-eval.html diff --git a/browser/devtools/canvasdebugger/canvasdebugger.js b/browser/devtools/canvasdebugger/canvasdebugger.js index cac1d2e7e820..30c904bd9e66 100644 --- a/browser/devtools/canvasdebugger/canvasdebugger.js +++ b/browser/devtools/canvasdebugger/canvasdebugger.js @@ -1253,8 +1253,9 @@ function getThumbnailForCall(thumbnails, index) { */ function viewSourceInDebugger(url, line) { let showSource = ({ DebuggerView }) => { - if (DebuggerView.Sources.containsValue(url)) { - DebuggerView.setEditorLocation(url, line, { noDebug: true }).then(() => { + let item = DebuggerView.Sources.getItemForAttachment(a => a.source.url === url); + if (item) { + DebuggerView.setEditorLocation(item.attachment.source.actor, line, { noDebug: true }).then(() => { window.emit(EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER); }, () => { window.emit(EVENTS.SOURCE_NOT_FOUND_IN_JS_DEBUGGER); diff --git a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js index 8fd6213a2bd7..c646d8709955 100644 --- a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js +++ b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-01.js @@ -64,7 +64,7 @@ function ifTestingSupported() { let toolbox = yield gDevTools.getToolbox(target); let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger"); - is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL, + is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL), "The expected source was shown in the debugger."); is(view.editor.getCursor().line, 25, "The expected source line is highlighted in the debugger."); diff --git a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js index 85d9c7d4d825..ee85fee4c79f 100644 --- a/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js +++ b/browser/devtools/canvasdebugger/test/browser_canvas-frontend-call-stack-02.js @@ -39,7 +39,7 @@ function ifTestingSupported() { let toolbox = yield gDevTools.getToolbox(target); let { panelWin: { DebuggerView: view } } = toolbox.getPanel("jsdebugger"); - is(view.Sources.selectedValue, SIMPLE_CANVAS_DEEP_STACK_URL, + is(view.Sources.selectedValue, getSourceActor(view.Sources, SIMPLE_CANVAS_DEEP_STACK_URL), "The expected source was shown in the debugger."); is(view.editor.getCursor().line, 23, "The expected source line is highlighted in the debugger."); diff --git a/browser/devtools/canvasdebugger/test/head.js b/browser/devtools/canvasdebugger/test/head.js index 9d94cf6f86a8..c1d8a1ebaf91 100644 --- a/browser/devtools/canvasdebugger/test/head.js +++ b/browser/devtools/canvasdebugger/test/head.js @@ -270,3 +270,8 @@ function evalInDebuggee (script) { return deferred.promise; } + +function getSourceActor(aSources, aURL) { + let item = aSources.getItemForAttachment(a => a.source.url === aURL); + return item ? item.value : null; +} diff --git a/browser/devtools/debugger/debugger-commands.js b/browser/devtools/debugger/debugger-commands.js index 20e326e89f60..72824c446869 100644 --- a/browser/devtools/debugger/debugger-commands.js +++ b/browser/devtools/debugger/debugger-commands.js @@ -36,7 +36,7 @@ function getAllBreakpoints(dbg) { for (let source of sources) { for (let { attachment: breakpoint } of source) { breakpoints.push({ - url: source.value, + url: source.attachment.source.url, label: source.attachment.label + ":" + breakpoint.line, lineNumber: breakpoint.line, lineText: breakpoint.text, @@ -48,6 +48,20 @@ function getAllBreakpoints(dbg) { return breakpoints; } +function getAllSources(dbg) { + if (!dbg) { + return []; + } + + let items = dbg._view.Sources.items; + return items + .filter(item => !!item.attachment.source.url) + .map(item => ({ + name: item.attachment.source.url, + value: item.attachment.source.actor + })); +} + /** * 'break' command */ @@ -142,12 +156,8 @@ exports.items.push({ name: "file", type: { name: "selection", - data: function(context) { - let dbg = getPanel(context, "jsdebugger"); - if (dbg) { - return dbg._view.Sources.values; - } - return []; + lookup: function(context) { + return getAllSources(getPanel(context, "jsdebugger")); } }, description: gcli.lookup("breakaddlineFileDesc") @@ -166,7 +176,10 @@ exports.items.push({ } let deferred = context.defer(); - let position = { url: args.file, line: args.line }; + let item = dbg._view.Sources.getItemForAttachment(a => { + return a.source && a.source.actor === args.file; + }) + let position = { actor: item.value, line: args.line }; dbg.addBreakpoint(position).then(() => { deferred.resolve(gcli.lookup("breakaddAdded")); @@ -211,8 +224,13 @@ exports.items.push({ return gcli.lookup("debuggerStopped"); } + let source = dbg._view.Sources.getItemForAttachment(a => { + return a.source && a.source.url === args.breakpoint.url + }); + let deferred = context.defer(); - let position = { url: args.breakpoint.url, line: args.breakpoint.lineNumber }; + let position = { actor: source.attachment.source.actor, + line: args.breakpoint.lineNumber }; dbg.removeBreakpoint(position).then(() => { deferred.resolve(gcli.lookup("breakdelRemoved")); @@ -390,14 +408,14 @@ exports.items.push({ return gcli.lookup("debuggerClosed"); } - let sources = dbg._view.Sources.values; + let sources = getAllSources(dbg); let doc = context.environment.chromeDocument; let div = createXHTMLElement(doc, "div"); let ol = createXHTMLElement(doc, "ol"); sources.forEach(source => { let li = createXHTMLElement(doc, "li"); - li.textContent = source; + li.textContent = source.name; ol.appendChild(li); }); div.appendChild(ol); @@ -433,12 +451,8 @@ exports.items.push({ name: "source", type: { name: "selection", - data: function(context) { - let dbg = getPanel(context, "jsdebugger"); - if (dbg) { - return dbg._view.Sources.values; - } - return []; + lookup: function(context) { + return getAllSources(getPanel(context, "jsdebugger")); } }, description: lookup("SourceDesc"), @@ -472,7 +486,7 @@ exports.items.push({ function shouldBlackBox(source) { var value = globRegExp && globRegExp.test(source.url) - || args.source && source.url == args.source; + || args.source && source.actor == args.source; return args.invert ? !value : value; } diff --git a/browser/devtools/debugger/debugger-controller.js b/browser/devtools/debugger/debugger-controller.js index 0d5ffe6a4ea7..23bb78268704 100644 --- a/browser/devtools/debugger/debugger-controller.js +++ b/browser/devtools/debugger/debugger-controller.js @@ -664,10 +664,12 @@ StackFrames.prototype = { _refillFrames: function() { // Make sure all the previous stackframes are removed before re-adding them. DebuggerView.StackFrames.empty(); + for (let frame of this.activeThread.cachedFrames) { - let { depth, where: { url, line }, source } = frame; + let { depth, source, where: { line } } = frame; + let isBlackBoxed = source ? this.activeThread.source(source).isBlackBoxed : false; - let location = NetworkHelper.convertToUnicode(unescape(url)); + let location = NetworkHelper.convertToUnicode(unescape(source.url || source.introductionUrl)); let title = StackFrameUtils.getFrameTitle(frame); DebuggerView.StackFrames.addFrame(title, location, line, depth, isBlackBoxed); } @@ -762,7 +764,7 @@ StackFrames.prototype = { } // Check if the frame does not represent the evaluation of debuggee code. - let { environment, where } = frame; + let { environment, where, source } = frame; if (!environment) { return; } @@ -774,10 +776,10 @@ StackFrames.prototype = { let isPopupShown = DebuggerView.VariableBubble.contentsShown(); if (!isClientEval && !isPopupShown) { // Move the editor's caret to the proper url and line. - DebuggerView.setEditorLocation(where.url, where.line); + DebuggerView.setEditorLocation(source.actor, where.line); } else { // Highlight the line where the execution is paused in the editor. - DebuggerView.setEditorLocation(where.url, where.line, { noCaret: true }); + DebuggerView.setEditorLocation(source.actor, where.line, { noCaret: true }); } // Highlight the breakpoint at the line and column if it exists. @@ -933,6 +935,7 @@ StackFrames.prototype = { if (!breakLocation) { return; } + let breakpointPromise = DebuggerController.Breakpoints._getAdded(breakLocation); if (!breakpointPromise) { return; @@ -1245,8 +1248,8 @@ SourceScripts.prototype = { /** * Handler for the debugger client's 'blackboxchange' notification. */ - _onBlackBoxChange: function (aEvent, { url, isBlackBoxed }) { - const item = DebuggerView.Sources.getItemByValue(url); + _onBlackBoxChange: function (aEvent, { actor, isBlackBoxed }) { + const item = DebuggerView.Sources.getItemByValue(actor); if (item) { item.prebuiltNode.classList.toggle("black-boxed", isBlackBoxed); } @@ -1312,13 +1315,13 @@ SourceScripts.prototype = { const deferred = promise.defer(); deferred.promise.pretty = wantPretty; - this._cache.set(aSource.url, deferred.promise); + this._cache.set(aSource.actor, deferred.promise); const afterToggle = ({ error, message, source: text, contentType }) => { if (error) { // Revert the rejected promise from the cache, so that the original // source's text may be shown when the source is selected. - this._cache.set(aSource.url, textPromise); + this._cache.set(aSource.actor, textPromise); deferred.reject([aSource, message || error]); return; } @@ -1360,13 +1363,13 @@ SourceScripts.prototype = { */ getText: function(aSource, aOnTimeout, aDelay = FETCH_SOURCE_RESPONSE_DELAY) { // Fetch the source text only once. - let textPromise = this._cache.get(aSource.url); + let textPromise = this._cache.get(aSource.actor); if (textPromise) { return textPromise; } let deferred = promise.defer(); - this._cache.set(aSource.url, deferred.promise); + this._cache.set(aSource.actor, deferred.promise); // If the source text takes a long time to fetch, invoke a callback. if (aOnTimeout) { @@ -1397,9 +1400,9 @@ SourceScripts.prototype = { * @return object * A promise that is resolved after source texts have been fetched. */ - getTextForSources: function(aUrls) { + getTextForSources: function(aActors) { let deferred = promise.defer(); - let pending = new Set(aUrls); + let pending = new Set(aActors); let fetched = []; // Can't use promise.all, because if one fetch operation is rejected, then @@ -1408,8 +1411,8 @@ SourceScripts.prototype = { // would work like a charm here. // Try to fetch as many sources as possible. - for (let url of aUrls) { - let sourceItem = DebuggerView.Sources.getItemByValue(url); + for (let actor of aActors) { + let sourceItem = DebuggerView.Sources.getItemByValue(actor); let sourceForm = sourceItem.attachment.source; this.getText(sourceForm, onTimeout).then(onFetch, onError); } @@ -1422,17 +1425,17 @@ SourceScripts.prototype = { /* Called if fetching a source finishes successfully. */ function onFetch([aSource, aText, aContentType]) { // If fetching the source has previously timed out, discard it this time. - if (!pending.has(aSource.url)) { + if (!pending.has(aSource.actor)) { return; } - pending.delete(aSource.url); - fetched.push([aSource.url, aText, aContentType]); + pending.delete(aSource.actor); + fetched.push([aSource.actor, aText, aContentType]); maybeFinish(); } /* Called if fetching a source failed because of an error. */ function onError([aSource, aError]) { - pending.delete(aSource.url); + pending.delete(aSource.actor); maybeFinish(); } @@ -1778,7 +1781,7 @@ EventListeners.prototype = { const msg = "Error getting function definition site: " + aResponse.message; DevToolsUtils.reportException("_getDefinitionSite", msg); } - deferred.resolve(aResponse.url); + deferred.resolve(aResponse.source.url); }); return deferred.promise; @@ -1838,25 +1841,26 @@ Breakpoints.prototype = { * Line number where breakpoint was set. */ _onEditorBreakpointAdd: Task.async(function*(_, aLine) { - let url = DebuggerView.Sources.selectedValue; - let location = { url: url, line: aLine + 1 }; - let breakpointClient = yield this.addBreakpoint(location, { noEditorUpdate: true }); + let actor = DebuggerView.Sources.selectedValue; + let location = { actor: actor, line: aLine + 1 }; // Initialize the breakpoint, but don't update the editor, since this - // callback is invoked because a breakpoint was added in the editor itself. - this.addBreakpoint(location, { noEditorUpdate: true }).then(aBreakpointClient => { - // If the breakpoint client has a "requestedLocation" attached, then - // the original requested placement for the breakpoint wasn't accepted. - // In this case, we need to update the editor with the new location. - if (breakpointClient.requestedLocation) { - DebuggerView.editor.moveBreakpoint( - breakpointClient.requestedLocation.line - 1, - breakpointClient.location.line - 1 - ); - } - // Notify that we've shown a breakpoint in the source editor. - window.emit(EVENTS.BREAKPOINT_SHOWN_IN_EDITOR); - }); + // callback is invoked because a breakpoint was added in the + // editor itself. + let breakpointClient = yield this.addBreakpoint(location, { noEditorUpdate: true }); + + // If the breakpoint client has a "requestedLocation" attached, then + // the original requested placement for the breakpoint wasn't accepted. + // In this case, we need to update the editor with the new location. + if (breakpointClient.requestedLocation) { + DebuggerView.editor.moveBreakpoint( + breakpointClient.requestedLocation.line - 1, + breakpointClient.location.line - 1 + ); + } + + // Notify that we've shown a breakpoint in the source editor. + window.emit(EVENTS.BREAKPOINT_SHOWN_IN_EDITOR); }), /** @@ -1866,8 +1870,8 @@ Breakpoints.prototype = { * Line number where breakpoint was removed. */ _onEditorBreakpointRemove: Task.async(function*(_, aLine) { - let url = DebuggerView.Sources.selectedValue; - let location = { url: url, line: aLine + 1 }; + let actor = DebuggerView.Sources.selectedValue; + let location = { actor: actor, line: aLine + 1 }; yield this.removeBreakpoint(location, { noEditorUpdate: true }); // Notify that we've hidden a breakpoint in the source editor. @@ -1883,11 +1887,13 @@ Breakpoints.prototype = { updateEditorBreakpoints: Task.async(function*() { for (let breakpointPromise of this._addedOrDisabled) { let breakpointClient = yield breakpointPromise; - let currentSourceUrl = DebuggerView.Sources.selectedValue; - let breakpointUrl = breakpointClient.location.url; + let location = breakpointClient.location; + let currentSourceActor = DebuggerView.Sources.selectedValue; + let sourceActor = DebuggerView.Sources.getActorForLocation(location); - // Update the view only if the breakpoint is in the currently shown source. - if (currentSourceUrl == breakpointUrl) { + // Update the view only if the breakpoint is in the currently + // shown source. + if (currentSourceActor === sourceActor) { yield this._showBreakpoint(breakpointClient, { noPaneUpdate: true }); } } @@ -1903,10 +1909,10 @@ Breakpoints.prototype = { for (let breakpointPromise of this._addedOrDisabled) { let breakpointClient = yield breakpointPromise; let container = DebuggerView.Sources; - let breakpointUrl = breakpointClient.location.url; + let sourceActor = breakpointClient.location.actor; // Update the view only if the breakpoint exists in a known source. - if (container.containsValue(breakpointUrl)) { + if (container.containsValue(sourceActor)) { yield this._showBreakpoint(breakpointClient, { noEditorUpdate: true }); } } @@ -1956,8 +1962,11 @@ Breakpoints.prototype = { let identifier = this.getIdentifier(aLocation); this._added.set(identifier, deferred.promise); - // Try adding the breakpoint. - gThreadClient.setBreakpoint(aLocation, Task.async(function*(aResponse, aBreakpointClient) { + let source = gThreadClient.source( + DebuggerView.Sources.getItemByValue(aLocation.actor).attachment.source + ); + + source.setBreakpoint(aLocation, Task.async(function*(aResponse, aBreakpointClient) { // If the breakpoint response has an "actualLocation" attached, then // the original requested placement for the breakpoint wasn't accepted. if (aResponse.actualLocation) { @@ -1988,8 +1997,10 @@ Breakpoints.prototype = { if (aResponse.actualLocation) { // Store the originally requested location in case it's ever needed // and update the breakpoint client with the actual location. + let actualLoc = aResponse.actualLocation; aBreakpointClient.requestedLocation = aLocation; - aBreakpointClient.location = aResponse.actualLocation; + aBreakpointClient.location = actualLoc; + aBreakpointClient.location.actor = actualLoc.source ? actualLoc.source.actor : null; } // Preserve information about the breakpoint's line text, to display it @@ -1999,7 +2010,8 @@ Breakpoints.prototype = { let line = aBreakpointClient.location.line - 1; aBreakpointClient.text = DebuggerView.editor.getText(line).trim(); - // Show the breakpoint in the editor and breakpoints pane, and resolve. + // Show the breakpoint in the editor and breakpoints pane, and + // resolve. yield this._showBreakpoint(aBreakpointClient, aOptions); // Notify that we've added a breakpoint. @@ -2142,30 +2154,31 @@ Breakpoints.prototype = { /** * Update the editor and breakpoints pane to show a specified breakpoint. * - * @param object aBreakpointData - * Information about the breakpoint to be shown. - * This object must have the following properties: - * - location: the breakpoint's source location and line number + * @param object aBreakpointClient + * A BreakpointClient instance. + * This object has additional properties dynamically added by + * our code: * - disabled: the breakpoint's disabled state, boolean * - text: the breakpoint's line text to be displayed * @param object aOptions [optional] * @see DebuggerController.Breakpoints.addBreakpoint */ - _showBreakpoint: function(aBreakpointData, aOptions = {}) { + _showBreakpoint: function(aBreakpointClient, aOptions = {}) { let tasks = []; - let currentSourceUrl = DebuggerView.Sources.selectedValue; - let location = aBreakpointData.location; + let currentSourceActor = DebuggerView.Sources.selectedValue; + let location = aBreakpointClient.location; + let actor = DebuggerView.Sources.getActorForLocation(location); // Update the editor if required. - if (!aOptions.noEditorUpdate && !aBreakpointData.disabled) { - if (location.url == currentSourceUrl) { + if (!aOptions.noEditorUpdate && !aBreakpointClient.disabled) { + if (currentSourceActor === actor) { tasks.push(DebuggerView.editor.addBreakpoint(location.line - 1)); } } // Update the breakpoints pane if required. if (!aOptions.noPaneUpdate) { - DebuggerView.Sources.addBreakpoint(aBreakpointData, aOptions); + DebuggerView.Sources.addBreakpoint(aBreakpointClient, aOptions); } return promise.all(tasks); @@ -2180,11 +2193,12 @@ Breakpoints.prototype = { * @see DebuggerController.Breakpoints.addBreakpoint */ _hideBreakpoint: function(aLocation, aOptions = {}) { - let currentSourceUrl = DebuggerView.Sources.selectedValue; + let currentSourceActor = DebuggerView.Sources.selectedValue; + let actor = DebuggerView.Sources.getActorForLocation(aLocation); // Update the editor if required. if (!aOptions.noEditorUpdate) { - if (aLocation.url == currentSourceUrl) { + if (currentSourceActor === actor) { DebuggerView.editor.removeBreakpoint(aLocation.line - 1); } } @@ -2233,7 +2247,8 @@ Breakpoints.prototype = { * The identifier string. */ getIdentifier: function(aLocation) { - return aLocation.url + ":" + aLocation.line; + return (aLocation.source ? aLocation.source.actor : aLocation.actor) + + ":" + aLocation.line; } }; @@ -2262,13 +2277,15 @@ function HitCounts() { HitCounts.prototype = { set: function({url, line, column}, aHitCount) { - if (!this._hitCounts[url]) { - this._hitCounts[url] = Object.create(null); + if (url) { + if (!this._hitCounts[url]) { + this._hitCounts[url] = Object.create(null); + } + if (!this._hitCounts[url][line]) { + this._hitCounts[url][line] = Object.create(null); + } + this._hitCounts[url][line][column] = aHitCount; } - if (!this._hitCounts[url][line]) { - this._hitCounts[url][line] = Object.create(null); - } - this._hitCounts[url][line][column] = aHitCount; }, /** @@ -2301,7 +2318,8 @@ HitCounts.prototype = { // No need to do anything if the counter's source is not being shown in the // editor. - if (DebuggerView.Sources.selectedValue != url) { + if (url && + DebuggerView.Sources.selectedItem.attachment.source.url != url) { return; } diff --git a/browser/devtools/debugger/debugger-panes.js b/browser/devtools/debugger/debugger-panes.js index b54b3f98b954..374e0c237780 100644 --- a/browser/devtools/debugger/debugger-panes.js +++ b/browser/devtools/debugger/debugger-panes.js @@ -133,11 +133,13 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { * - staged: true to stage the item to be appended later */ addSource: function(aSource, aOptions = {}) { - let fullUrl = aSource.url; - let url = fullUrl.split(" -> ").pop(); - let label = aSource.addonPath ? aSource.addonPath : SourceUtils.getSourceLabel(url); - let group = aSource.addonID ? aSource.addonID : SourceUtils.getSourceGroup(url); - let unicodeUrl = NetworkHelper.convertToUnicode(unescape(fullUrl)); + if (!(aSource.url || aSource.introductionUrl)) { + // These would be most likely eval scripts introduced in inline + // JavaScript in HTML, and we don't show those yet (bug 1097873) + return; + } + + let { label, group, unicodeUrl } = this._parseUrl(aSource); let contents = document.createElement("label"); contents.className = "plain dbg-source-item"; @@ -152,7 +154,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { } // Append a source item to this container. - this.push([contents, fullUrl], { + this.push([contents, aSource.actor], { staged: aOptions.staged, /* stage the item to be appended later? */ attachment: { label: label, @@ -164,20 +166,32 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { }); }, + _parseUrl: function(aSource) { + let fullUrl = aSource.url || aSource.introductionUrl; + let url = fullUrl.split(" -> ").pop(); + let label = aSource.addonPath ? aSource.addonPath : SourceUtils.getSourceLabel(url); + + if (aSource.introductionUrl) { + label += ' > eval'; + } + + return { + label: label, + group: aSource.addonID ? aSource.addonID : SourceUtils.getSourceGroup(url), + unicodeUrl: NetworkHelper.convertToUnicode(unescape(fullUrl)) + }; + }, + /** * Adds a breakpoint to this sources container. * - * @param object aBreakpointData - * Information about the breakpoint to be shown. - * This object must have the following properties: - * - location: the breakpoint's source location and line number - * - disabled: the breakpoint's disabled state, boolean - * - text: the breakpoint's line text to be displayed + * @param object aBreakpointClient + * See Breakpoints.prototype._showBreakpoint * @param object aOptions [optional] * @see DebuggerController.Breakpoints.addBreakpoint */ - addBreakpoint: function(aBreakpointData, aOptions = {}) { - let { location, disabled } = aBreakpointData; + addBreakpoint: function(aBreakpointClient, aOptions = {}) { + let { location, disabled } = aBreakpointClient; // Make sure we're not duplicating anything. If a breakpoint at the // specified source url and line already exists, just toggle it. @@ -187,17 +201,17 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { } // Get the source item to which the breakpoint should be attached. - let sourceItem = this.getItemByValue(location.url); + let sourceItem = this.getItemByValue(this.getActorForLocation(location)); // Create the element node and menu popup for the breakpoint item. - let breakpointArgs = Heritage.extend(aBreakpointData, aOptions); + let breakpointArgs = Heritage.extend(aBreakpointClient, aOptions); let breakpointView = this._createBreakpointView.call(this, breakpointArgs); let contextMenu = this._createContextMenu.call(this, breakpointArgs); // Append a breakpoint child item to the corresponding source item. sourceItem.append(breakpointView.container, { attachment: Heritage.extend(breakpointArgs, { - url: location.url, + actor: location.actor, line: location.line, view: breakpointView, popup: contextMenu @@ -210,7 +224,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { finalize: this._onBreakpointRemoved }); - // Highlight the newly appended breakpoint child item if necessary. + // Highlight the newly appended breakpoint child item if + // necessary. if (aOptions.openPopup || !aOptions.noEditorUpdate) { this.highlightBreakpoint(location, aOptions); } @@ -228,7 +243,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { removeBreakpoint: function(aLocation) { // When a parent source item is removed, all the child breakpoint items are // also automagically removed. - let sourceItem = this.getItemByValue(aLocation.url); + let sourceItem = this.getItemByValue(aLocation.actor); if (!sourceItem) { return; } @@ -253,7 +268,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { */ getBreakpoint: function(aLocation) { return this.getItemForPredicate(aItem => - aItem.attachment.url == aLocation.url && + aItem.attachment.actor == aLocation.actor && aItem.attachment.line == aLocation.line); }, @@ -280,8 +295,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { getOtherBreakpoints: function(aLocation = {}, aStore = []) { for (let source of this) { for (let breakpointItem of source) { - let { url, line } = breakpointItem.attachment; - if (url != aLocation.url || line != aLocation.line) { + let { actor, line } = breakpointItem.attachment; + if (actor != aLocation.actor || line != aLocation.line) { aStore.push(breakpointItem); } } @@ -404,7 +419,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { // Update the editor location if necessary. if (!aOptions.noEditorUpdate) { - DebuggerView.setEditorLocation(aLocation.url, aLocation.line, { noDebug: true }); + DebuggerView.setEditorLocation(aLocation.actor, aLocation.line, { noDebug: true }); } // If the breakpoint requires a new conditional expression, display @@ -421,9 +436,10 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { * if it exists. */ highlightBreakpointAtCursor: function() { - let url = DebuggerView.Sources.selectedValue; + let actor = DebuggerView.Sources.selectedValue; let line = DebuggerView.editor.getCursor().line + 1; - let location = { url: url, line: line }; + + let location = { actor: actor, line: line }; this.highlightBreakpoint(location, { noEditorUpdate: true }); }, @@ -466,10 +482,10 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { return; } - const resetEditor = ([{ url }]) => { + const resetEditor = ([{ actor }]) => { // Only set the text when the source is still selected. - if (url == this.selectedValue) { - DebuggerView.setEditorLocation(url, 0, { force: true }); + if (actor == this.selectedValue) { + DebuggerView.setEditorLocation(actor, 0, { force: true }); } }; @@ -564,6 +580,31 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { } }, + /** + * Look up a source actor id for a location. This is necessary for + * backwards compatibility; otherwise we could just use the `actor` + * property. Older servers don't use the same actor ids for sources + * across reloads, so we resolve a url to the current actor if a url + * exists. + * + * @param object aLocation + * An object with the following properties: + * - actor: the source actor id + * - url: a url (might be null) + */ + getActorForLocation: function(aLocation) { + if (aLocation.url) { + for (var item of this) { + let source = item.attachment.source; + + if (aLocation.url === source.url) { + return source.actor; + } + } + } + return aLocation.actor; + }, + /** * Marks a breakpoint as selected in this sources container. * @@ -575,6 +616,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { return; } this._unselectBreakpoint(); + this._selectedBreakpointItem = aItem; this._selectedBreakpointItem.target.classList.add("selected"); @@ -820,9 +862,9 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { let editor = DebuggerView.editor; let start = editor.getCursor("start").line + 1; let end = editor.getCursor().line + 1; - let url = this.selectedValue; + let actor = this.selectedValue; - let location = { url: url, line: start }; + let location = { actor: actor, line: start }; if (this.getBreakpoint(location) && start == end) { this.highlightBreakpoint(location, { noEditorUpdate: true }); @@ -854,7 +896,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { // Set window title. No need to split the url by " -> " here, because it was // already sanitized when the source was added. - document.title = L10N.getFormatStr("DebuggerWindowScriptTitle", sourceItem.value); + document.title = L10N.getFormatStr("DebuggerWindowScriptTitle", + sourceItem.attachment.source.url); DebuggerView.maybeShowBlackBoxMessage(); this.updateToolbarButtonsState(); @@ -974,11 +1017,11 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { * Called when the add breakpoint key sequence was pressed. */ _onCmdAddBreakpoint: function(e) { - let url = DebuggerView.Sources.selectedValue; + let actor = DebuggerView.Sources.selectedValue; let line = (e && e.sourceEvent.target.tagName == 'menuitem' ? DebuggerView.clickedLine + 1 : DebuggerView.editor.getCursor().line + 1); - let location = { url: url, line: line }; + let location = { actor, line }; let breakpointItem = this.getBreakpoint(location); // If a breakpoint already existed, remove it now. @@ -995,11 +1038,11 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, { * Called when the add conditional breakpoint key sequence was pressed. */ _onCmdAddConditionalBreakpoint: function(e) { - let url = DebuggerView.Sources.selectedValue; + let actor = DebuggerView.Sources.selectedValue; let line = (e && e.sourceEvent.target.tagName == 'menuitem' ? DebuggerView.clickedLine + 1 : DebuggerView.editor.getCursor().line + 1); - let location = { url: url, line: line }; + let location = { actor, line }; let breakpointItem = this.getBreakpoint(location); // If a breakpoint already existed or wasn't a conditional, morph it now. @@ -1313,7 +1356,11 @@ TracerView.prototype = Heritage.extend(WidgetMethods, { const data = traceItem.attachment.trace; const { location: { url, line } } = data; - DebuggerView.setEditorLocation(url, line, { noDebug: true }); + DebuggerView.setEditorLocation( + DebuggerView.Sources.getActorForLocation({ url }), + line, + { noDebug: true } + ); DebuggerView.Variables.empty(); const scope = DebuggerView.Variables.addScope(); @@ -1538,7 +1585,7 @@ let SourceUtils = { * True if the source is likely javascript. */ isJavaScript: function(aUrl, aContentType = "") { - return /\.jsm?$/.test(this.trimUrlQuery(aUrl)) || + return (aUrl && /\.jsm?$/.test(this.trimUrlQuery(aUrl))) || aContentType.contains("javascript"); }, @@ -2744,8 +2791,8 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, { // Allow requests to settle down first. setNamedTimeout("global-search", delay, () => { // Start fetching as many sources as possible, then perform the search. - let urls = DebuggerView.Sources.values; - let sourcesFetched = DebuggerController.SourceScripts.getTextForSources(urls); + let actors = DebuggerView.Sources.values; + let sourcesFetched = DebuggerController.SourceScripts.getTextForSources(actors); sourcesFetched.then(aSources => this._doSearch(aToken, aSources)); }); }, @@ -2774,13 +2821,19 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, { let globalResults = new GlobalResults(); // Search for the specified token in each source's text. - for (let [url, text] of aSources) { + for (let [actor, text] of aSources) { + let item = DebuggerView.Sources.getItemByValue(actor); + let url = item.attachment.source.url; + if (!url) { + continue; + } + // Verify that the search token is found anywhere in the source. if (!text.toLowerCase().contains(lowerCaseToken)) { continue; } // ...and if so, create a Map containing search details for each line. - let sourceResults = new SourceResults(url, globalResults); + let sourceResults = new SourceResults(actor, globalResults); // Search for the specified token in each line's text. text.split("\n").forEach((aString, aLine) => { @@ -2917,10 +2970,10 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, { this._scrollMatchIntoViewIfNeeded(target); this._bounceMatch(target); - let url = sourceResultsItem.instance.url; + let actor = sourceResultsItem.instance.actor; let line = lineResultsItem.instance.line; - DebuggerView.setEditorLocation(url, line + 1, { noDebug: true }); + DebuggerView.setEditorLocation(actor, line + 1, { noDebug: true }); let range = lineResultsItem.lineData.range; let cursor = DebuggerView.editor.getOffset({ line: line, ch: 0 }); @@ -2995,13 +3048,15 @@ GlobalResults.prototype = { * An object containing all the matched lines for a specific source. * Iterable via "for (let [lineNumber, lineResults] of sourceResults) { }". * - * @param string aUrl - * The target source url. + * @param string aActor + * The target source actor id. * @param GlobalResults aGlobalResults * An object containing all source results, grouped by source location. */ -function SourceResults(aUrl, aGlobalResults) { - this.url = aUrl; +function SourceResults(aActor, aGlobalResults) { + let item = DebuggerView.Sources.getItemByValue(aActor); + this.actor = aActor; + this.label = item.attachment.source.url; this._globalResults = aGlobalResults; this._store = []; } @@ -3083,7 +3138,7 @@ SourceResults.prototype = { let locationNode = document.createElement("label"); locationNode.className = "plain dbg-results-header-location"; - locationNode.setAttribute("value", this.url); + locationNode.setAttribute("value", this.label); let matchCountNode = document.createElement("label"); matchCountNode.className = "plain dbg-results-header-match-count"; @@ -3116,14 +3171,14 @@ SourceResults.prototype = { resultsBox.appendChild(resultsHeader); resultsBox.appendChild(resultsContainer); - aElementNode.id = "source-results-" + this.url; + aElementNode.id = "source-results-" + this.actor; aElementNode.className = "dbg-source-results"; aElementNode.appendChild(resultsBox); SourceResults._itemsByElement.set(aElementNode, { instance: this }); }, - url: "", + actor: "", _globalResults: null, _store: null, _target: null, diff --git a/browser/devtools/debugger/debugger-toolbar.js b/browser/devtools/debugger/debugger-toolbar.js index 804274b3e776..695bbd68df7c 100644 --- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -936,7 +936,7 @@ FilterView.prototype = { DebuggerView.GlobalSearch.scheduleSearch(this.searchArguments[0]); break; case SEARCH_FUNCTION_FLAG: - // Schedule a function search for when the user stops typing. + // Schedule a function search for when the user stops typing. DebuggerView.FilteredFunctions.scheduleSearch(this.searchArguments[0]); break; case SEARCH_VARIABLE_FLAG: @@ -1117,7 +1117,7 @@ FilterView.prototype = { if (SEARCH_AUTOFILL.indexOf(aOperator) != -1) { let cursor = DebuggerView.editor.getCursor(); let content = DebuggerView.editor.getText(); - let location = DebuggerView.Sources.selectedValue; + let location = DebuggerView.Sources.selectedItem.attachment.source.url; let source = DebuggerController.Parser.get(content, location); let identifier = source.getIdentifierAt({ line: cursor.line+1, column: cursor.ch }); @@ -1306,19 +1306,23 @@ FilteredSourcesView.prototype = Heritage.extend(ResultsPanelContainer.prototype, } for (let item of aSearchResults) { - // Create the element node for the location item. - let itemView = this._createItemView( - SourceUtils.trimUrlLength(item.attachment.label), - SourceUtils.trimUrlLength(item.value, 0, "start") - ); + let url = item.attachment.source.url; - // Append a location item to this container for each match. - this.push([itemView], { - index: -1, /* specifies on which position should the item be appended */ - attachment: { - url: item.value - } - }); + if (url) { + // Create the element node for the location item. + let itemView = this._createItemView( + SourceUtils.trimUrlLength(item.attachment.label), + SourceUtils.trimUrlLength(url, 0, "start") + ); + + // Append a location item to this container for each match. + this.push([itemView], { + index: -1, /* specifies on which position should the item be appended */ + attachment: { + url: url + } + }); + } } // There's at least one item displayed in this container. Don't select it @@ -1351,7 +1355,8 @@ FilteredSourcesView.prototype = Heritage.extend(ResultsPanelContainer.prototype, */ _onSelect: function({ detail: locationItem }) { if (locationItem) { - DebuggerView.setEditorLocation(locationItem.attachment.url, undefined, { + let actor = DebuggerView.Sources.getActorForLocation({ url: locationItem.attachment.url }); + DebuggerView.setEditorLocation(actor, undefined, { noCaret: true, noDebug: true }); @@ -1408,8 +1413,8 @@ FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototyp // Allow requests to settle down first. setNamedTimeout("function-search", delay, () => { // Start fetching as many sources as possible, then perform the search. - let urls = DebuggerView.Sources.values; - let sourcesFetched = DebuggerController.SourceScripts.getTextForSources(urls); + let actors = DebuggerView.Sources.values; + let sourcesFetched = DebuggerController.SourceScripts.getTextForSources(actors); sourcesFetched.then(aSources => this._doSearch(aToken, aSources)); }); }, @@ -1429,8 +1434,8 @@ FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototyp // Make sure the currently displayed source is parsed first. Once the // maximum allowed number of results are found, parsing will be halted. - let currentUrl = DebuggerView.Sources.selectedValue; - let currentSource = aSources.filter(([sourceUrl]) => sourceUrl == currentUrl)[0]; + let currentActor = DebuggerView.Sources.selectedValue; + let currentSource = aSources.filter(([actor]) => actor == currentActor)[0]; aSources.splice(aSources.indexOf(currentSource), 1); aSources.unshift(currentSource); @@ -1440,8 +1445,14 @@ FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototyp aSources.splice(1); } - for (let [location, contents] of aSources) { - let parsedSource = DebuggerController.Parser.get(contents, location); + for (let [actor, contents] of aSources) { + let item = DebuggerView.Sources.getItemByValue(actor); + let url = item.attachment.source.url; + if (!url) { + continue; + } + + let parsedSource = DebuggerController.Parser.get(contents, url); let sourceResults = parsedSource.getNamedFunctionDefinitions(aToken); for (let scriptResult of sourceResults) { @@ -1553,10 +1564,11 @@ FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototyp _onSelect: function({ detail: functionItem }) { if (functionItem) { let sourceUrl = functionItem.attachment.sourceUrl; + let actor = DebuggerView.Sources.getActorForLocation({ url: sourceUrl }); let scriptOffset = functionItem.attachment.scriptOffset; let actualLocation = functionItem.attachment.actualLocation; - DebuggerView.setEditorLocation(sourceUrl, actualLocation.start.line, { + DebuggerView.setEditorLocation(actor, actualLocation.start.line, { charOffset: scriptOffset, columnOffset: actualLocation.start.column, align: "center", diff --git a/browser/devtools/debugger/debugger-view.js b/browser/devtools/debugger/debugger-view.js index c4fd7ebfcdcf..6333fe264e0e 100644 --- a/browser/devtools/debugger/debugger-view.js +++ b/browser/devtools/debugger/debugger-view.js @@ -246,7 +246,7 @@ let DebuggerView = { this.editor.on("gutterClick", (ev, line, button) => { // A right-click shouldn't do anything but keep track of where // it was clicked. - if(button == 2) { + if (button == 2) { this.clickedLine = line; } else { @@ -390,7 +390,7 @@ let DebuggerView = { */ _setEditorSource: function(aSource, aFlags={}) { // Avoid setting the same source text in the editor again. - if (this._editorSource.url == aSource.url && !aFlags.force) { + if (this._editorSource.actor == aSource.actor && !aFlags.force) { return this._editorSource.promise; } let transportType = gClient.localTransport ? "_LOCAL" : "_REMOTE"; @@ -401,20 +401,21 @@ let DebuggerView = { let deferred = promise.defer(); this._setEditorText(L10N.getStr("loadingText")); - this._editorSource = { url: aSource.url, promise: deferred.promise }; + this._editorSource = { actor: aSource.actor, promise: deferred.promise }; DebuggerController.SourceScripts.getText(aSource).then(([, aText, aContentType]) => { // Avoid setting an unexpected source. This may happen when switching // very fast between sources that haven't been fetched yet. - if (this._editorSource.url != aSource.url) { + if (this._editorSource.actor != aSource.actor) { return; } this._setEditorText(aText); this._setEditorMode(aSource.url, aContentType, aText); - // Synchronize any other components with the currently displayed source. - DebuggerView.Sources.selectedValue = aSource.url; + // Synchronize any other components with the currently displayed + // source. + DebuggerView.Sources.selectedValue = aSource.actor; DebuggerController.Breakpoints.updateEditorBreakpoints(); DebuggerController.HitCounts.updateEditorHitCounts(); @@ -442,8 +443,8 @@ let DebuggerView = { * Update the source editor's current caret and debug location based on * a requested url and line. * - * @param string aUrl - * The target source url. + * @param string aActor + * The target actor id. * @param number aLine [optional] * The target line in the source. * @param object aFlags [optional] @@ -459,9 +460,9 @@ let DebuggerView = { * @return object * A promise that is resolved after the source text has been set. */ - setEditorLocation: function(aUrl, aLine = 0, aFlags = {}) { + setEditorLocation: function(aActor, aLine = 0, aFlags = {}) { // Avoid trying to set a source for a url that isn't known yet. - if (!this.Sources.containsValue(aUrl)) { + if (!this.Sources.containsValue(aActor)) { return promise.reject(new Error("Unknown source for the specified URL.")); } @@ -471,17 +472,23 @@ let DebuggerView = { let cachedFrames = DebuggerController.activeThread.cachedFrames; let currentDepth = DebuggerController.StackFrames.currentFrameDepth; let frame = cachedFrames[currentDepth]; - if (frame && frame.where.url == aUrl) { + if (frame && frame.source.actor == aActor) { aLine = frame.where.line; } } - let sourceItem = this.Sources.getItemByValue(aUrl); + let sourceItem = this.Sources.getItemByValue(aActor); let sourceForm = sourceItem.attachment.source; + this._editorLoc = { actor: sourceForm.actor }; + // Make sure the requested source client is shown in the editor, then // update the source editor's caret position and debug location. return this._setEditorSource(sourceForm, aFlags).then(([,, aContentType]) => { + if (this._editorLoc.actor !== sourceForm.actor) { + return; + } + // Record the contentType learned from fetching sourceForm.contentType = aContentType; // Line numbers in the source editor should start from 1. If invalid diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini index 77902919e5ea..935269c9d972 100644 --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -25,6 +25,7 @@ support-files = code_math.min.js code_math_bogus_map.js code_same-line-functions.js + code_script-eval.js code_script-switching-01.js code_script-switching-02.js code_test-editor-mode @@ -84,6 +85,7 @@ support-files = doc_scope-variable-2.html doc_scope-variable-3.html doc_scope-variable-4.html + doc_script-eval.html doc_script-switching-01.html doc_script-switching-02.html doc_split-console-paused-reload.html @@ -169,6 +171,8 @@ skip-if = e10s && debug skip-if = e10s # Bug 1093535 [browser_dbg_breakpoints-editor.js] skip-if = e10s && debug +[browser_dbg_breakpoints-eval.js] +skip-if = e10s && debug [browser_dbg_breakpoints-highlight.js] skip-if = e10s && debug [browser_dbg_breakpoints-new-script.js] @@ -401,6 +405,8 @@ skip-if = e10s && debug skip-if = e10s # Bug 1093535 [browser_dbg_sources-cache.js] skip-if = e10s && debug +[browser_dbg_sources-eval.js] +skip-if = e10s && debug [browser_dbg_sources-labels.js] skip-if = e10s && debug [browser_dbg_sources-sorting.js] diff --git a/browser/devtools/debugger/test/browser_dbg_addon-sources.js b/browser/devtools/debugger/test/browser_dbg_addon-sources.js index 2f64df53698d..89b4ebcbd864 100644 --- a/browser/devtools/debugger/test/browser_dbg_addon-sources.js +++ b/browser/devtools/debugger/test/browser_dbg_addon-sources.js @@ -5,6 +5,7 @@ // addon itself, or the SDK, with proper groups and labels. const ADDON_URL = EXAMPLE_URL + "addon3.xpi"; +let gClient; function test() { Task.spawn(function () { diff --git a/browser/devtools/debugger/test/browser_dbg_addonactor.js b/browser/devtools/debugger/test/browser_dbg_addonactor.js index 319881b9f2a6..d2e794569030 100644 --- a/browser/devtools/debugger/test/browser_dbg_addonactor.js +++ b/browser/devtools/debugger/test/browser_dbg_addonactor.js @@ -25,8 +25,8 @@ function test() { .then(attachAddonThread) .then(testDebugger) .then(testSources) - .then(uninstallAddon) .then(closeConnection) + .then(uninstallAddon) .then(finish) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); @@ -72,10 +72,9 @@ function testSources() { gThreadClient.getSources(aResponse => { // source URLs contain launch-specific temporary directory path, // hence the ".contains" call. - const matches = aResponse.sources.filter(s => - s.url.contains(ADDON_MODULE_URL)); - is(matches.length, 1, - "the main script of the addon is present in the source list"); + const matches = aResponse.sources.filter(s => s.url.contains(ADDON_MODULE_URL)); + ok(matches.length > 0, + "the main script of the addon is present in the source list"); deferred.resolve(); }); diff --git a/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js b/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js index 113b1ae25bd3..2ed04bd1129c 100644 --- a/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js +++ b/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-01.js @@ -36,12 +36,12 @@ function test(){ .then(testAutoPrettyPrintOff) .then(() => { let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN); - gSources.selectedIndex = 1; - return finished; + gSources.selectedIndex = 1; + return finished; }) .then(testSecondSourceLabel) .then(testSourceIsUgly) - // Re-enable auto pretty printing for browser_dbg_auto-pretty-print-02.js + // Re-enable auto pretty printing for browser_dbg_auto-pretty-print-02.js .then(enableAutoPrettyPrint) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { @@ -56,7 +56,8 @@ function testSourceIsUgly() { } function testSecondSourceLabel(){ - ok(gSources.containsValue(EXAMPLE_URL + gSecondSourceLabel), + let source = gSources.selectedItem.attachment.source; + ok(source.url === EXAMPLE_URL + gSecondSourceLabel, "Second source url is correct."); } diff --git a/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-02.js b/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-02.js index 394178d8ea18..65261a040582 100644 --- a/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-02.js +++ b/browser/devtools/debugger/test/browser_dbg_auto-pretty-print-02.js @@ -68,12 +68,14 @@ function testSourceIsUgly() { } function testFirstSourceLabel(){ - ok(gSources.containsValue(EXAMPLE_URL + gFirstSourceLabel), + let source = gSources.selectedItem.attachment.source; + ok(source.url === EXAMPLE_URL + gFirstSourceLabel, "First source url is correct."); } function testSecondSourceLabel(){ - ok(gSources.containsValue(EXAMPLE_URL + gSecondSourceLabel), + let source = gSources.selectedItem.attachment.source; + ok(source.url === EXAMPLE_URL + gSecondSourceLabel, "Second source url is correct."); } diff --git a/browser/devtools/debugger/test/browser_dbg_blackboxing-03.js b/browser/devtools/debugger/test/browser_dbg_blackboxing-03.js index bf733368607c..374fb8f1ff07 100644 --- a/browser/devtools/debugger/test/browser_dbg_blackboxing-03.js +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-03.js @@ -10,7 +10,7 @@ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js" let gTab, gPanel, gDebugger; -let gFrames; +let gFrames, gSources; function test() { initDebugger(TAB_URL).then(([aTab,, aPanel]) => { @@ -18,6 +18,7 @@ function test() { gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; + gSources = gDebugger.DebuggerView.Sources; waitForSourceAndCaretAndScopes(gPanel, ".html", 21) .then(testBlackBoxStack) @@ -39,7 +40,7 @@ function testBlackBoxStack() { } function testBlackBoxSource() { - return toggleBlackBoxing(gPanel, BLACKBOXME_URL).then(aSource => { + return toggleBlackBoxing(gPanel, getSourceActor(gSources, BLACKBOXME_URL)).then(aSource => { ok(aSource.isBlackBoxed, "The source should be black boxed now."); is(gFrames.itemCount, 3, @@ -54,4 +55,5 @@ registerCleanupFunction(function() { gPanel = null; gDebugger = null; gFrames = null; + gSources = null; }); diff --git a/browser/devtools/debugger/test/browser_dbg_blackboxing-04.js b/browser/devtools/debugger/test/browser_dbg_blackboxing-04.js index 1d5820a69661..4d3df406d686 100644 --- a/browser/devtools/debugger/test/browser_dbg_blackboxing-04.js +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-04.js @@ -10,7 +10,7 @@ const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js" let gTab, gPanel, gDebugger; -let gFrames; +let gFrames, gSources; function test() { initDebugger(TAB_URL).then(([aTab,, aPanel]) => { @@ -18,6 +18,7 @@ function test() { gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; + gSources = gDebugger.DebuggerView.Sources; waitForSourceShown(gPanel, BLACKBOXME_URL) .then(blackBoxSources) @@ -31,9 +32,10 @@ function test() { function blackBoxSources() { let finished = waitForThreadEvents(gPanel, "blackboxchange", 3); - toggleBlackBoxing(gPanel, EXAMPLE_URL + "code_blackboxing_one.js"); - toggleBlackBoxing(gPanel, EXAMPLE_URL + "code_blackboxing_two.js"); - toggleBlackBoxing(gPanel, EXAMPLE_URL + "code_blackboxing_three.js"); + + toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_one.js")); + toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_two.js")); + toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_three.js")); return finished; } @@ -54,4 +56,5 @@ registerCleanupFunction(function() { gPanel = null; gDebugger = null; gFrames = null; + gSources = null; }); diff --git a/browser/devtools/debugger/test/browser_dbg_blackboxing-06.js b/browser/devtools/debugger/test/browser_dbg_blackboxing-06.js index c2a7a43ba9c7..25fbd3ae308f 100644 --- a/browser/devtools/debugger/test/browser_dbg_blackboxing-06.js +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-06.js @@ -30,15 +30,15 @@ function test() { } function testBlackBox() { - const selectedUrl = gSources.selectedValue; + const selectedActor = gSources.selectedValue; let finished = waitForSourceShown(gPanel, "blackboxme.js").then(() => { - const newSelectedUrl = gSources.selectedValue; - isnot(selectedUrl, newSelectedUrl, + const newSelectedActor = gSources.selectedValue; + isnot(selectedActor, newSelectedActor, "Should not have the same url selected."); return toggleBlackBoxing(gPanel).then(() => { - is(gSources.selectedValue, newSelectedUrl, + is(gSources.selectedValue, newSelectedActor, "The selected source did not change."); }); }); diff --git a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js b/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js index 0ba569395b71..40b8a5170a5f 100644 --- a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js +++ b/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js @@ -18,7 +18,7 @@ function test() { gSources = gDebugger.DebuggerView.Sources; gFrames = gDebugger.DebuggerView.StackFrames; - waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1) + waitForSourceAndCaretAndScopes(gPanel, "-02.js", 6) .then(checkNavigationWhileNotFocused) .then(focusCurrentStackFrame) .then(checkNavigationWhileFocused) @@ -31,13 +31,13 @@ function test() { }); function checkNavigationWhileNotFocused() { - checkState({ frame: 3, source: 1, line: 1 }); + checkState({ frame: 1, source: 1, line: 6 }); EventUtils.sendKey("DOWN", gDebugger); - checkState({ frame: 3, source: 1, line: 2 }); + checkState({ frame: 1, source: 1, line: 7 }); EventUtils.sendKey("UP", gDebugger); - checkState({ frame: 3, source: 1, line: 1 }); + checkState({ frame: 1, source: 1, line: 6 }); } function focusCurrentStackFrame() { @@ -50,45 +50,37 @@ function test() { return Task.spawn(function() { yield promise.all([ waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), - EventUtils.sendKey("UP", gDebugger) - ]); - checkState({ frame: 2, source: 1, line: 1 }); - - yield promise.all([ - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), - waitForSourceAndCaret(gPanel, "-01.js", 1), - EventUtils.sendKey("UP", gDebugger) - ]); - checkState({ frame: 1, source: 0, line: 1 }); - - yield promise.all([ - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), + waitForSourceAndCaret(gPanel, "-01.js", 5), + waitForEditorLocationSet(gPanel), EventUtils.sendKey("UP", gDebugger) ]); checkState({ frame: 0, source: 0, line: 5 }); yield promise.all([ waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), - waitForSourceAndCaret(gPanel, "-02.js", 1), + waitForSourceAndCaret(gPanel, "-02.js", 6), + waitForEditorLocationSet(gPanel), EventUtils.sendKey("END", gDebugger) ]); - checkState({ frame: 3, source: 1, line: 1 }); + checkState({ frame: 1, source: 1, line: 6 }); yield promise.all([ waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES), - waitForSourceAndCaret(gPanel, "-01.js", 1), + waitForSourceAndCaret(gPanel, "-01.js", 5), + waitForEditorLocationSet(gPanel), EventUtils.sendKey("HOME", gDebugger) ]); + checkState({ frame: 0, source: 0, line: 5 }); }); } - function checkState({ frame, source, line }) { + function checkState({ frame, source, line, column }) { is(gFrames.selectedIndex, frame, "The currently selected stackframe is incorrect."); is(gSources.selectedIndex, source, "The currently selected source is incorrect."); - ok(isCaretPos(gPanel, line), + ok(isCaretPos(gPanel, line, column), "The source editor caret position was incorrect."); } } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location.js index de303d829e69..cc9fcb72ecf7 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location.js @@ -35,7 +35,7 @@ function test() { "No breakpoints currently shown in the editor."); gEditor.on("breakpointAdded", onEditorBreakpointAdd); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 4 }).then(onBreakpointAdd); + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 4 }).then(onBreakpointAdd); } let onBpDebuggerAdd = false; @@ -44,12 +44,12 @@ function test() { function onBreakpointAdd(aBreakpointClient) { ok(aBreakpointClient, "Breakpoint added, client received."); - is(aBreakpointClient.location.url, gSources.selectedValue, + is(aBreakpointClient.location.actor, gSources.selectedValue, "Breakpoint client url is the same."); is(aBreakpointClient.location.line, 6, "Breakpoint client line is new."); - is(aBreakpointClient.requestedLocation.url, gSources.selectedValue, + is(aBreakpointClient.requestedLocation.actor, gSources.selectedValue, "Requested location url is correct"); is(aBreakpointClient.requestedLocation.line, 4, "Requested location line is correct"); @@ -64,19 +64,19 @@ function test() { is(gEditor.getBreakpoints().length, 1, "There is only one breakpoint in the editor"); - ok(!gBreakpoints._getAdded({ url: gSources.selectedValue, line: 4 }), + ok(!gBreakpoints._getAdded({ actor: gSources.selectedValue, line: 4 }), "There isn't any breakpoint added on an invalid line."); - ok(!gBreakpoints._getRemoving({ url: gSources.selectedValue, line: 4 }), + ok(!gBreakpoints._getRemoving({ actor: gSources.selectedValue, line: 4 }), "There isn't any breakpoint removed from an invalid line."); - ok(gBreakpoints._getAdded({ url: gSources.selectedValue, line: 6 }), + ok(gBreakpoints._getAdded({ actor: gSources.selectedValue, line: 6 }), "There is a breakpoint added on the actual line."); - ok(!gBreakpoints._getRemoving({ url: gSources.selectedValue, line: 6 }), + ok(!gBreakpoints._getRemoving({ actor: gSources.selectedValue, line: 6 }), "There isn't any breakpoint removed from the actual line."); - gBreakpoints._getAdded({ url: gSources.selectedValue, line: 6 }).then(aBreakpointClient => { - is(aBreakpointClient.location.url, gSources.selectedValue, - "Breakpoint client location url is correct."); + gBreakpoints._getAdded({ actor: gSources.selectedValue, line: 6 }).then(aBreakpointClient => { + is(aBreakpointClient.location.actor, gSources.selectedValue, + "Breakpoint client location actor is correct."); is(aBreakpointClient.location.line, 6, "Breakpoint client location line is correct."); diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location2.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location2.js index 24d293ca082e..e44335792257 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location2.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-actual-location2.js @@ -37,16 +37,16 @@ function test() { Task.spawn(function*() { let bpClient = yield gPanel.addBreakpoint({ - url: gSources.selectedValue, + actor: gSources.selectedValue, line: 19 }); yield gPanel.addBreakpoint({ - url: gSources.selectedValue, + actor: gSources.selectedValue, line: 20 }); let movedBpClient = yield gPanel.addBreakpoint({ - url: gSources.selectedValue, + actor: gSources.selectedValue, line: 17 }); testMovedLocation(movedBpClient); @@ -54,7 +54,7 @@ function test() { yield resumeAndTestBreakpoint(19); yield gPanel.removeBreakpoint({ - url: gSources.selectedValue, + actor: gSources.selectedValue, line: 19 }); @@ -89,12 +89,12 @@ function test() { function testMovedLocation(breakpointClient) { ok(breakpointClient, "Breakpoint added, client received."); - is(breakpointClient.location.url, gSources.selectedValue, + is(breakpointClient.location.actor, gSources.selectedValue, "Breakpoint client url is the same."); is(breakpointClient.location.line, 19, "Breakpoint client line is new."); - is(breakpointClient.requestedLocation.url, gSources.selectedValue, + is(breakpointClient.requestedLocation.actor, gSources.selectedValue, "Requested location url is correct"); is(breakpointClient.requestedLocation.line, 17, "Requested location line is correct"); diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js index f2951bc7801b..b069e944c421 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js @@ -13,13 +13,14 @@ function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); - let gPanel, gDebugger, gThreadClient, gEvents; + let gPanel, gDebugger, gThreadClient, gEvents, gSources; initDebugger(TAB_URL).then(([aTab,, aPanel]) => { gPanel = aPanel; gDebugger = gPanel.panelWin; gThreadClient = gDebugger.gThreadClient; gEvents = gDebugger.EVENTS; + gSources = gDebugger.DebuggerView.Sources; Task.spawn(function* () { try { @@ -92,8 +93,11 @@ function test() { }); function setBreakpoint(location) { + let item = gSources.getItemByValue(getSourceActor(gSources, location.url)); + let source = gThreadClient.source(item.attachment.source); + let deferred = promise.defer(); - gThreadClient.setBreakpoint(location, ({ error, message }, bpClient) => { + source.setBreakpoint(location, ({ error, message }, bpClient) => { if (error) { deferred.reject(error + ": " + message); } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-button-01.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-button-01.js index 70f52ba37cbe..40d787a8ad04 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-button-01.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-button-01.js @@ -31,9 +31,9 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.values[0], line: 5 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 6 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 7 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[0], line: 5 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 6 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 7 })) .then(() => ensureThreadClientState(gPanel, "resumed")); } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-button-02.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-button-02.js index dcb55f6c2b48..9ae835396ecf 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-button-02.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-button-02.js @@ -33,16 +33,16 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.values[0], line: 5 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 6 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 7 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[0], line: 5 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 6 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 7 })) .then(() => ensureThreadClientState(gPanel, "resumed")); } function disableSomeBreakpoints() { return promise.all([ - gSources.disableBreakpoint({ url: gSources.values[0], line: 5 }), - gSources.disableBreakpoint({ url: gSources.values[1], line: 6 }) + gSources.disableBreakpoint({ actor: gSources.values[0], line: 5 }), + gSources.disableBreakpoint({ actor: gSources.values[1], line: 6 }) ]); } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu-add.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu-add.js index 92ebb7438edf..36cdac034cd3 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu-add.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu-add.js @@ -66,7 +66,7 @@ function test() { "1 breakpoint correctly added"); is(gEditor.getBreakpoints().length, 1, "1 breakpoint currently shown in the editor."); - ok(gBreakpoints._getAdded({ url: gSources.values[1], line: 7 }), + ok(gBreakpoints._getAdded({ actor: gSources.values[1], line: 7 }), "Breakpoint on line 7 exists"); }); } @@ -88,7 +88,7 @@ function test() { "2 breakpoints correctly added"); is(gEditor.getBreakpoints().length, 2, "2 breakpoints currently shown in the editor."); - ok(gBreakpoints._getAdded({ url: gSources.values[1], line: 8 }), + ok(gBreakpoints._getAdded({ actor: gSources.values[1], line: 8 }), "Breakpoint on line 8 exists"); }); } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js index b68ae94a0a22..2b8139dd35b3 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js @@ -32,11 +32,11 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.values[0], line: 5 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 6 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 7 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 8 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 9 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[0], line: 5 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 6 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 7 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 8 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 9 })) .then(() => ensureThreadClientState(gPanel, "resumed")); } @@ -79,7 +79,8 @@ function test() { function pauseAndCheck() { let finished = waitForSourceAndCaretAndScopes(gPanel, "-01.js", 5).then(() => { - is(gSources.selectedValue, EXAMPLE_URL + "code_script-switching-01.js", + let source = gSources.selectedItem.attachment.source; + is(source.url, EXAMPLE_URL + "code_script-switching-01.js", "The currently selected source is incorrect (3)."); is(gSources.selectedIndex, 0, "The currently selected source is incorrect (4)."); @@ -87,7 +88,8 @@ function test() { "The editor location is correct after pausing."); }); - is(gSources.selectedValue, EXAMPLE_URL + "code_script-switching-02.js", + let source = gSources.selectedItem.attachment.source; + is(source.url, EXAMPLE_URL + "code_script-switching-02.js", "The currently selected source is incorrect (1)."); is(gSources.selectedIndex, 1, "The currently selected source is incorrect (2)."); diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-disabled-reload.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-disabled-reload.js index 3b27a4edd703..f9e49147534d 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-disabled-reload.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-disabled-reload.js @@ -15,10 +15,12 @@ function test() { let gEditor = gDebugger.DebuggerView.editor; let gSources = gDebugger.DebuggerView.Sources; let gBreakpoints = gDebugger.DebuggerController.Breakpoints; - let gBreakpointLocation = { url: EXAMPLE_URL + "code_script-switching-01.js", line: 5 }; - + let gBreakpointLocation; Task.spawn(function() { yield waitForSourceShown(aPanel, "-01.js"); + gBreakpointLocation = { actor: getSourceActor(gSources, EXAMPLE_URL + "code_script-switching-01.js"), + line: 5 }; + yield aPanel.addBreakpoint(gBreakpointLocation); yield ensureThreadClientState(aPanel, "resumed"); @@ -102,13 +104,13 @@ function test() { callInTab(gTab, "firstCall"); yield waitForDebuggerEvents(aPanel, gEvents.FETCHED_SCOPES); yield ensureSourceIs(aPanel, "-02.js"); - yield ensureCaretAt(aPanel, 1); + yield ensureCaretAt(aPanel, 6); yield verifyView({ disabled: true, visible: false }); executeSoon(() => gDebugger.gThreadClient.resume()); yield waitForDebuggerEvents(aPanel, gEvents.AFTER_FRAMES_CLEARED); yield ensureSourceIs(aPanel, "-02.js"); - yield ensureCaretAt(aPanel, 1); + yield ensureCaretAt(aPanel, 6); yield verifyView({ disabled: true, visible: false }); }); } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-editor.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-editor.js index a20961b6e35e..c7174c8f8cbc 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-editor.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-editor.js @@ -31,7 +31,7 @@ function test() { "Should only be getting stack frames while paused."); is(gSources.itemCount, 2, "Found the expected number of sources."); - is(gEditor.getText().indexOf("debugger"), 172, + is(gEditor.getText().indexOf("debugger"), 166, "The correct source was loaded initially."); is(gSources.selectedValue, gSources.values[1], "The correct source is selected."); @@ -52,7 +52,7 @@ function test() { "The second source should be currently selected."); info("Add the first breakpoint."); - let location = { url: gSources.selectedValue, line: 6 }; + let location = { actor: gSources.selectedValue, line: 6 }; gEditor.once("breakpointAdded", onEditorBreakpointAddFirst); gPanel.addBreakpoint(location).then(onBreakpointAddFirst); } @@ -78,7 +78,7 @@ function test() { ok(aBreakpointClient, "breakpoint1 added, client received."); - is(aBreakpointClient.location.url, gSources.selectedValue, + is(aBreakpointClient.location.actor, gSources.selectedValue, "breakpoint1 client url is correct."); is(aBreakpointClient.location.line, 6, "breakpoint1 client line is correct."); @@ -123,7 +123,7 @@ function test() { ok(aLocation, "breakpoint1 removed"); - is(aLocation.url, gSources.selectedValue, + is(aLocation.actor, gSources.selectedValue, "breakpoint1 removal url is correct."); is(aLocation.line, 6, "breakpoint1 removal line is correct."); @@ -139,16 +139,16 @@ function test() { is(gEditor.getBreakpoints().length, 0, "No breakpoints currently shown in the editor."); - ok(!gBreakpoints._getAdded({ url: gSources.selectedValue, line: 6 }), + ok(!gBreakpoints._getAdded({ actor: gSources.selectedValue, line: 6 }), "_getAdded('gSources.selectedValue', 6) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: gSources.selectedValue, line: 6 }), + ok(!gBreakpoints._getRemoving({ actor: gSources.selectedValue, line: 6 }), "_getRemoving('gSources.selectedValue', 6) returns falsey."); is(gSources.values[1], gSources.selectedValue, "The second source should be currently selected."); info("Add a breakpoint to the first source, which is not selected."); - let location = { url: gSources.values[0], line: 5 }; + let location = { actor: gSources.values[0], line: 5 }; let options = { noEditorUpdate: true }; gEditor.on("breakpointAdded", onEditorBreakpointAddBackgroundTrap); gPanel.addBreakpoint(location, options).then(onBreakpointAddBackground); @@ -166,7 +166,7 @@ function test() { ok(aBreakpointClient, "breakpoint2 added, client received"); - is(aBreakpointClient.location.url, gSources.values[0], + is(aBreakpointClient.location.actor, gSources.values[0], "breakpoint2 client url is correct."); is(aBreakpointClient.location.line, 5, "breakpoint2 client line is correct."); @@ -276,19 +276,19 @@ function test() { is(gEditor.getBreakpoints().length, 0, "No breakpoints currently shown in the editor."); - ok(!gBreakpoints._getAdded({ url: gSources.values[0], line: 5 }), + ok(!gBreakpoints._getAdded({ actor: gSources.values[0], line: 5 }), "_getAdded('gSources.values[0]', 5) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: gSources.values[0], line: 5 }), + ok(!gBreakpoints._getRemoving({ actor: gSources.values[0], line: 5 }), "_getRemoving('gSources.values[0]', 5) returns falsey."); - ok(!gBreakpoints._getAdded({ url: gSources.values[1], line: 6 }), + ok(!gBreakpoints._getAdded({ actor: gSources.values[1], line: 6 }), "_getAdded('gSources.values[1]', 6) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: gSources.values[1], line: 6 }), + ok(!gBreakpoints._getRemoving({ actor: gSources.values[1], line: 6 }), "_getRemoving('gSources.values[1]', 6) returns falsey."); - ok(!gBreakpoints._getAdded({ url: "foo", line: 3 }), + ok(!gBreakpoints._getAdded({ actor: "foo", line: 3 }), "_getAdded('foo', 3) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: "bar", line: 3 }), + ok(!gBreakpoints._getRemoving({ actor: "bar", line: 3 }), "_getRemoving('bar', 3) returns falsey."); is(breakpointsAdded, 2, diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-eval.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-eval.js new file mode 100644 index 000000000000..c1d4e74c3f4e --- /dev/null +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-eval.js @@ -0,0 +1,46 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test setting breakpoints on an eval script + */ + +const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; + +function test() { + let gTab, gPanel, gDebugger; + let gSources, gBreakpoints; + + initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + gTab = aTab; + gPanel = aPanel; + gDebugger = gPanel.panelWin; + gSources = gDebugger.DebuggerView.Sources; + gBreakpoints = gDebugger.DebuggerController.Breakpoints; + + waitForSourceShown(gPanel, "-eval.js") + .then(run) + .then(null, aError => { + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); + }); + }); + + function run() { + return Task.spawn(function*() { + let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE); + callInTab(gTab, "evalSource"); + yield newSource; + + yield gPanel.addBreakpoint({ actor: gSources.values[1], line: 2 }); + yield ensureThreadClientState(gPanel, "resumed"); + + const paused = waitForThreadEvents(gPanel, "paused"); + callInTab(gTab, "bar"); + let frame = (yield paused).frame; + is(frame.where.source.actor, gSources.values[1], "Should have broken on the eval'ed source"); + is(frame.where.line, 2, "Should break on line 2"); + + yield resumeDebuggerThenCloseAndFinish(gPanel); + }); + } +} diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-highlight.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-highlight.js index eed20b243ae7..468cb0d90057 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-highlight.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-highlight.js @@ -35,17 +35,17 @@ function test() { function addBreakpoints() { return promise.resolve(null) .then(() => initialChecks(0, 1)) - .then(() => gPanel.addBreakpoint({ url: gSources.values[0], line: 5 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[0], line: 5 })) .then(() => initialChecks(0, 5)) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 6 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 6 })) .then(() => waitForSourceShown(gPanel, "-02.js")) .then(() => waitForCaretUpdated(gPanel, 6)) .then(() => initialChecks(1, 6)) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 7 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 7 })) .then(() => initialChecks(1, 7)) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 8 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 8 })) .then(() => initialChecks(1, 8)) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 9 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 9 })) .then(() => initialChecks(1, 9)); } @@ -80,10 +80,10 @@ function test() { return finished; } - function checkHighlight(aUrl, aLine) { - is(gSources._selectedBreakpointItem, gSources.getBreakpoint({ url: aUrl, line: aLine }), + function checkHighlight(aActor, aLine) { + is(gSources._selectedBreakpointItem, gSources.getBreakpoint({ actor: aActor, line: aLine }), "The currently selected breakpoint item is incorrect."); - is(gSources._selectedBreakpointItem.attachment.url, aUrl, + is(gSources._selectedBreakpointItem.attachment.actor, aActor, "The selected breakpoint item's source location attachment is incorrect."); is(gSources._selectedBreakpointItem.attachment.line, aLine, "The selected breakpoint item's source line number is incorrect."); @@ -96,7 +96,7 @@ function test() { is(gEditor.getText().indexOf("firstCall"), 118, "The first source is correctly displayed."); } else { - is(gEditor.getText().indexOf("debugger"), 172, + is(gEditor.getText().indexOf("debugger"), 166, "The second source is correctly displayed."); } } diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-new-script.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-new-script.js index f87e1f5fea55..b92472c653e7 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-new-script.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-new-script.js @@ -8,13 +8,14 @@ const TAB_URL = EXAMPLE_URL + "doc_inline-script.html"; -let gTab, gPanel, gDebugger; +let gTab, gPanel, gDebugger, gSources; function test() { initDebugger(TAB_URL).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; + gSources = gDebugger.DebuggerView.Sources; addBreakpoint(); }); @@ -27,7 +28,7 @@ function addBreakpoint() { ok(isCaretPos(gPanel, 16), "The source editor caret position is incorrect (1)."); - gPanel.addBreakpoint({ url: TAB_URL, line: 20 }).then(() => { + gPanel.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 }).then(() => { testResume(); }); }); @@ -83,4 +84,5 @@ registerCleanupFunction(function() { gTab = null; gPanel = null; gDebugger = null; + gSources = null; }); diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-other-tabs.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-other-tabs.js index 6bcf45675f33..7aed9c502149 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-other-tabs.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-other-tabs.js @@ -17,7 +17,7 @@ let test = Task.async(function* () { const sources = panel1.panelWin.DebuggerView.Sources; yield panel1.addBreakpoint({ - url: sources.selectedValue, + actor: sources.selectedValue, line: 2 }); diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-pane.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-pane.js index 3d7ef117af3e..452f3cd2a464 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-pane.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-pane.js @@ -35,7 +35,7 @@ function test() { "Should only be getting stack frames while paused."); is(gSources.itemCount, 2, "Found the expected number of sources."); - is(gEditor.getText().indexOf("debugger"), 172, + is(gEditor.getText().indexOf("debugger"), 166, "The correct source was loaded initially."); is(gSources.selectedValue, gSources.values[1], "The correct source is selected."); @@ -135,21 +135,21 @@ function test() { function addBreakpoints(aIncrementFlag) { let deferred = promise.defer(); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 6 }).then(aClient => { + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 6 }).then(aClient => { onBreakpointAdd(aClient, { increment: aIncrementFlag, line: 6, - text: "eval(\"debugger;\");" + text: "debugger;" }); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 7 }).then(aClient => { + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 7 }).then(aClient => { onBreakpointAdd(aClient, { increment: aIncrementFlag, line: 7, text: "function foo() {}" }); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 9 }).then(aClient => { + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 9 }).then(aClient => { onBreakpointAdd(aClient, { increment: aIncrementFlag, line: 9, diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-reload.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-reload.js index 52ba4f962331..312ea389ed70 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-reload.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-reload.js @@ -16,9 +16,8 @@ let test = Task.async(function* () { yield ensureSourceIs(panel, "doc_breakpoints-reload.html", true); const sources = panel.panelWin.DebuggerView.Sources; - yield panel.addBreakpoint({ - url: sources.selectedValue, + actor: sources.selectedValue, line: 10 // "break on me" string }); @@ -31,5 +30,6 @@ let test = Task.async(function* () { is(packet.frame.where.line, 10, "Should have stopped at line 10, where we set the breakpoint"); + yield waitForDebuggerEvents(panel, panel.panelWin.EVENTS.SOURCE_SHOWN) yield resumeDebuggerThenCloseAndFinish(panel); }); diff --git a/browser/devtools/debugger/test/browser_dbg_clean-exit.js b/browser/devtools/debugger/test/browser_dbg_clean-exit.js index b7700d7579ca..4d41504ee206 100644 --- a/browser/devtools/debugger/test/browser_dbg_clean-exit.js +++ b/browser/devtools/debugger/test/browser_dbg_clean-exit.js @@ -20,11 +20,12 @@ function test() { } function testCleanExit() { - waitForSourceAndCaretAndScopes(gPanel, ".html", 16).then(() => { + promise.all([ + waitForSourceAndCaretAndScopes(gPanel, ".html", 16), + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED) + ]).then(() => { is(gDebugger.gThreadClient.paused, true, "Should be paused after the debugger statement."); - - return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED); }).then(() => closeDebuggerAndFinish(gPanel, { whilePaused: true })); callInTab(gTab, "runDebuggerStatement"); diff --git a/browser/devtools/debugger/test/browser_dbg_cmd-break.js b/browser/devtools/debugger/test/browser_dbg_cmd-break.js index 240a3472848c..702c01059586 100644 --- a/browser/devtools/debugger/test/browser_dbg_cmd-break.js +++ b/browser/devtools/debugger/test/browser_dbg_cmd-break.js @@ -6,14 +6,20 @@ */ const TAB_URL = EXAMPLE_URL + "doc_cmd-break.html"; +let TAB_URL_ACTOR; function test() { - let gPanel, gDebugger, gThreadClient; + let gPanel, gDebugger, gThreadClient, gSources; let gLineNumber; + let expectedActorObj = { + value: null, + message: '' + }; + helpers.addTabWithToolbar(TAB_URL, aOptions => { - return helpers.audit(aOptions, [ - { + return Task.spawn(function() { + yield helpers.audit(aOptions, [{ setup: 'break', check: { input: 'break', @@ -21,8 +27,9 @@ function test() { markup: 'IIIII', status: 'ERROR', } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break add', check: { input: 'break add', @@ -30,8 +37,9 @@ function test() { markup: 'IIIIIVIII', status: 'ERROR' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break add line', check: { input: 'break add line', @@ -39,8 +47,9 @@ function test() { markup: 'VVVVVVVVVVVVVV', status: 'ERROR' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ name: 'open toolbox', setup: function() { return initDebugger(gBrowser.selectedTab).then(([aTab, aDebuggee, aPanel]) => { @@ -53,15 +62,19 @@ function test() { gDebugger = gPanel.panelWin; gThreadClient = gPanel.panelWin.gThreadClient; gLineNumber = '' + aOptions.window.wrappedJSObject.gLineNumber; + gSources = gDebugger.DebuggerView.Sources; + + expectedActorObj.value = getSourceActor(gSources, TAB_URL); }); }); }, post: function() { ok(gThreadClient, "Debugger client exists."); - is(gLineNumber, 1, "gLineNumber is correct."); + is(gLineNumber, 14, "gLineNumber is correct."); }, - }, - { + }]); + + yield helpers.audit(aOptions, [{ name: 'break add line .../doc_cmd-break.html 14', setup: function() { // We have to setup in a function to allow gLineNumber to be initialized. @@ -73,30 +86,32 @@ function test() { status: 'VALID', message: '', args: { - file: { value: TAB_URL, message: '' }, - line: { value: 1 } + file: expectedActorObj, + line: { value: 14 } } }, exec: { output: 'Added breakpoint' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break add line ' + TAB_URL + ' 17', check: { hints: '', status: 'VALID', message: '', args: { - file: { value: TAB_URL, message: '' }, + file: expectedActorObj, line: { value: 17 } } }, exec: { output: 'Added breakpoint' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break list', check: { input: 'break list', @@ -107,25 +122,27 @@ function test() { exec: { output: [ /Source/, /Remove/, - /doc_cmd-break\.html:1/, - /doc_cmd-break\.html:1/ + /doc_cmd-break\.html:14/, + /doc_cmd-break\.html:17/ ] } - }, - { + }]); + + yield helpers.audit(aOptions, [{ name: 'cleanup', setup: function() { let deferred = promise.defer(); gThreadClient.resume(deferred.resolve); return deferred.promise; } - }, - { - setup: 'break del 1', + }]); + + yield helpers.audit(aOptions, [{ + setup: 'break del 14', check: { - input: 'break del 1', - hints: ' -> doc_cmd-break.html:1', - markup: 'VVVVVVVVVVI', + input: 'break del 14', + hints: ' -> doc_cmd-break.html:14', + markup: 'VVVVVVVVVVII', status: 'ERROR', args: { breakpoint: { @@ -134,23 +151,25 @@ function test() { } } } - }, - { - setup: 'break del doc_cmd-break.html:1', + }]); + + yield helpers.audit(aOptions, [{ + setup: 'break del doc_cmd-break.html:14', check: { - input: 'break del doc_cmd-break.html:1', + input: 'break del doc_cmd-break.html:14', hints: '', - markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', status: 'VALID', args: { - breakpoint: { arg: ' doc_cmd-break.html:1' }, + breakpoint: { arg: ' doc_cmd-break.html:14' }, } }, exec: { output: 'Breakpoint removed' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break list', check: { input: 'break list', @@ -164,8 +183,9 @@ function test() { /doc_cmd-break\.html:17/ ] } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break del doc_cmd-break.html:17', check: { input: 'break del doc_cmd-break.html:17', @@ -179,8 +199,9 @@ function test() { exec: { output: 'Breakpoint removed' } - }, - { + }]); + + yield helpers.audit(aOptions, [{ setup: 'break list', check: { input: 'break list', @@ -194,7 +215,7 @@ function test() { post: function() { return teardown(gPanel, { noTabRemoval: true }); } - }, - ]); + }]); + }); }).then(finish); } diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-01.js b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-01.js index ea3b1eb103b7..952035efba4e 100644 --- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-01.js +++ b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-01.js @@ -71,31 +71,31 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 18 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 18 })) .then(aClient => aClient.conditionalExpression = "undefined") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 19 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 19 })) .then(aClient => aClient.conditionalExpression = "null") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 20 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 20 })) .then(aClient => aClient.conditionalExpression = "42") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 21 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 21 })) .then(aClient => aClient.conditionalExpression = "true") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 22 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 22 })) .then(aClient => aClient.conditionalExpression = "'nasu'") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 23 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 23 })) .then(aClient => aClient.conditionalExpression = "/regexp/") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 24 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 24 })) .then(aClient => aClient.conditionalExpression = "({})") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 25 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 25 })) .then(aClient => aClient.conditionalExpression = "(function() {})") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 26 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 26 })) .then(aClient => aClient.conditionalExpression = "(function() { return false; })()") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 27 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 27 })) .then(aClient => aClient.conditionalExpression = "a") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 28 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 28 })) .then(aClient => aClient.conditionalExpression = "a !== undefined") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 29 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 29 })) .then(aClient => aClient.conditionalExpression = "b") - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, line: 30 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 30 })) .then(aClient => aClient.conditionalExpression = "a !== null"); } @@ -163,19 +163,21 @@ function test() { // Highlight the breakpoint only if required. if (aHighlightBreakpoint) { let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine)); - gSources.highlightBreakpoint({ url: gSources.selectedValue, line: aLine }); + gSources.highlightBreakpoint({ actor: gSources.selectedValue, line: aLine }); return finished; } - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane."); ok(selectedBreakpoint, "There should be a selected breakpoint in the sources pane."); - is(selectedBreakpoint.attachment.url, selectedUrl, + let source = gSources.selectedItem.attachment.source; + + is(selectedBreakpoint.attachment.actor, source.actor, "The breakpoint on line " + aLine + " wasn't added on the correct source."); is(selectedBreakpoint.attachment.line, aLine, "The breakpoint on line " + aLine + " wasn't found."); @@ -187,7 +189,7 @@ function test() { "The breakpoint conditional expression popup should not have been shown."); return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => { - is(aBreakpointClient.location.url, selectedUrl, + is(aBreakpointClient.location.url, source.url, "The breakpoint's client url is correct"); is(aBreakpointClient.location.line, aLine, "The breakpoint's client line is correct"); @@ -200,10 +202,10 @@ function test() { } function testAfterReload() { - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane after reload."); ok(!selectedBreakpoint, "There should be no selected breakpoint in the sources pane after reload."); diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-02.js b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-02.js index e53ec31fe0d4..2fff3b6dd53c 100644 --- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-02.js +++ b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-02.js @@ -86,15 +86,15 @@ function test() { is(gEditor.getBreakpoints().length, 0, "No breakpoints currently shown in the editor."); - ok(!gBreakpoints._getAdded({ url: "foo", line: 3 }), + ok(!gBreakpoints._getAdded({ actor: "foo", line: 3 }), "_getAdded('foo', 3) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: "bar", line: 3 }), + ok(!gBreakpoints._getRemoving({ actor: "bar", line: 3 }), "_getRemoving('bar', 3) returns falsey."); } function addBreakpoint1() { let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 18 }); + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 18 }); return finished; } @@ -141,15 +141,17 @@ function test() { } function testBreakpoint(aLine, aOpenPopupFlag, aPopupVisible, aConditionalExpression) { - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane."); ok(selectedBreakpoint, - "There should be a selected brekapoint in the sources pane."); + "There should be a selected brekapoint in the sources pane."); - is(selectedBreakpoint.attachment.url, selectedUrl, + let source = gSources.selectedItem.attachment.source; + + is(selectedBreakpoint.attachment.actor, source.actor, "The breakpoint on line " + aLine + " wasn't added on the correct source."); is(selectedBreakpoint.attachment.line, aLine, "The breakpoint on line " + aLine + " wasn't found."); @@ -161,8 +163,8 @@ function test() { "The breakpoint on line " + aLine + " should have a correct popup state (2)."); return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => { - is(aBreakpointClient.location.url, selectedUrl, - "The breakpoint's client url is correct"); + is(aBreakpointClient.location.actor, selectedActor, + "The breakpoint's client actor is correct"); is(aBreakpointClient.location.line, aLine, "The breakpoint's client line is correct"); is(aBreakpointClient.conditionalExpression, aConditionalExpression, @@ -176,10 +178,10 @@ function test() { } function testNoBreakpoint(aLine) { - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane for line " + aLine + "."); ok(!selectedBreakpoint, "There should be no selected brekapoint in the sources pane for line " + aLine + "."); diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-03.js b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-03.js index c4a29050b451..18edd85ae481 100644 --- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-03.js +++ b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-03.js @@ -23,7 +23,7 @@ function test() { var client = gPanel.target.client; client.mainRoot.traits.conditionalBreakpoints = false; - gLocation = { url: gSources.selectedValue, line: 18 }; + gLocation = { actor: gSources.selectedValue, line: 18 }; waitForSourceAndCaretAndScopes(gPanel, ".html", 17) .then(addBreakpoint) diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-04.js b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-04.js index d36a4800f9dd..3197139c1674 100644 --- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-04.js +++ b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints-04.js @@ -24,7 +24,7 @@ function test() { var client = gPanel.target.client; client.mainRoot.traits.conditionalBreakpoints = false; - gLocation = { url: gSources.selectedValue, line: 18 }; + gLocation = { actor: gSources.selectedValue, line: 18 }; waitForSourceAndCaretAndScopes(gPanel, ".html", 17) .then(addBreakpoint) diff --git a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js index 3c4317f0a306..41b98756caea 100644 --- a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js +++ b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-01.js @@ -21,7 +21,7 @@ function test() { function checkView(frameDepth, selectedSource, caretLine, editorText) { is(win.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); - is(framesView.itemCount, 4, + is(framesView.itemCount, 2, "Should have four frames."); is(framesView.selectedDepth, frameDepth, "The correct frame is selected in the widget."); @@ -46,8 +46,8 @@ function test() { } callInTab(tab, "firstCall"); - yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1); - checkView(0, 1, 1, [/secondCall/, 118]); + yield waitForSourceAndCaretAndScopes(panel, "-02.js", 6); + checkView(0, 1, 6, [/secondCall/, 118]); // Eval in the topmost frame, while paused. let updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES); @@ -57,13 +57,13 @@ function test() { is(result.return.class, "Function", "The evaluation return class is correct."); yield updatedView; - checkView(0, 1, 1, [/secondCall/, 118]); + checkView(0, 1, 6, [/secondCall/, 118]); ok(true, "Evaluating in the topmost frame works properly."); // Eval in a different frame, while paused. updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES); try { - yield frames.evaluate("foo", { depth: 3 }); // oldest frame + yield frames.evaluate("foo", { depth: 1 }); // oldest frame } catch (result) { is(result.return.type, "object", "The evaluation thrown type is correct."); is(result.return.class, "Error", "The evaluation thrown class is correct."); @@ -71,7 +71,7 @@ function test() { } yield updatedView; - checkView(0, 1, 1, [/secondCall/, 118]); + checkView(0, 1, 6, [/secondCall/, 118]); ok(true, "Evaluating in a custom frame works properly."); // Eval in a non-existent frame, while paused. diff --git a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js index 44eb14913890..441bac5414a2 100644 --- a/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js +++ b/browser/devtools/debugger/test/browser_dbg_controller-evaluate-02.js @@ -21,7 +21,7 @@ function test() { function checkView(selectedFrame, selectedSource, caretLine, editorText) { is(win.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); - is(framesView.itemCount, 4, + is(framesView.itemCount, 2, "Should have four frames."); is(framesView.selectedDepth, selectedFrame, "The correct frame is selected in the widget."); @@ -39,14 +39,14 @@ function test() { // Allow this generator function to yield first. callInTab(tab, "firstCall"); - yield waitForSourceAndCaretAndScopes(panel, "-02.js", 1); - checkView(0, 1, 1, [/secondCall/, 118]); + yield waitForSourceAndCaretAndScopes(panel, "-02.js", 6); + checkView(0, 1, 6, [/secondCall/, 118]); // Change the selected frame and eval inside it. let updatedFrame = waitForDebuggerEvents(panel, events.FETCHED_SCOPES); - framesView.selectedDepth = 3; // oldest frame + framesView.selectedDepth = 1; // oldest frame yield updatedFrame; - checkView(3, 0, 5, [/firstCall/, 118]); + checkView(1, 0, 5, [/firstCall/, 118]); let updatedView = waitForDebuggerEvents(panel, events.FETCHED_SCOPES); try { @@ -58,7 +58,7 @@ function test() { } yield updatedView; - checkView(3, 0, 5, [/firstCall/, 118]); + checkView(1, 0, 5, [/firstCall/, 118]); ok(true, "Evaluating while in a user-selected frame works properly."); yield resumeDebuggerThenCloseAndFinish(panel); diff --git a/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js index a67a3b20cfa6..00d45e77f930 100644 --- a/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js +++ b/browser/devtools/debugger/test/browser_dbg_editor-contextmenu.js @@ -28,7 +28,7 @@ function test() { "Should only be getting stack frames while paused."); is(gSources.itemCount, 2, "Found the expected number of sources."); - is(gEditor.getText().indexOf("debugger"), 172, + is(gEditor.getText().indexOf("debugger"), 166, "The correct source was loaded initially."); is(gSources.selectedValue, gSources.values[1], "The correct source is selected."); diff --git a/browser/devtools/debugger/test/browser_dbg_editor-mode.js b/browser/devtools/debugger/test/browser_dbg_editor-mode.js index 8a513b4bbef4..dc379e517df5 100644 --- a/browser/devtools/debugger/test/browser_dbg_editor-mode.js +++ b/browser/devtools/debugger/test/browser_dbg_editor-mode.js @@ -40,7 +40,7 @@ function testInitialSource() { "Found the expected editor mode."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 141, + is(gEditor.getText().search(/debugger/), 135, "The second source is displayed."); is(gEditor.getText().search(/banana/), -1, "The third source is not displayed."); diff --git a/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js b/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js index 224ab4df82b8..c0c7ae7c24dd 100644 --- a/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js +++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-01.js @@ -77,7 +77,7 @@ function testEventListeners(aThreadClient) { lDeferred.reject(msg); return; } - listener.function.url = aResponse.url; + listener.function.url = aResponse.source.url; lDeferred.resolve(listener); }); return lDeferred.promise; @@ -97,7 +97,12 @@ function testEventListeners(aThreadClient) { ok(func, "There is a function property."); is(func.type, "object", "The function form is of type 'object'."); is(func.class, "Function", "The function form is of class 'Function'."); - is(func.url, TAB_URL, "The function url is correct."); + + // The onchange handler is an inline string that doesn't have + // a URL because it's basically eval'ed + if (l.type !== 'change') { + is(func.url, TAB_URL, "The function url is correct."); + } is(l.allowsUntrusted, true, "'allowsUntrusted' property has the right value."); diff --git a/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js b/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js index 4b3069637aad..dd97a6d081f1 100644 --- a/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js +++ b/browser/devtools/debugger/test/browser_dbg_event-listeners-02.js @@ -78,7 +78,7 @@ function testEventListeners(aThreadClient) { lDeferred.reject(msg); return; } - listener.function.url = aResponse.url; + listener.function.url = aResponse.source.url; lDeferred.resolve(listener); }); return lDeferred.promise; diff --git a/browser/devtools/debugger/test/browser_dbg_file-reload.js b/browser/devtools/debugger/test/browser_dbg_file-reload.js index 29f8906820d0..db15015694e0 100644 --- a/browser/devtools/debugger/test/browser_dbg_file-reload.js +++ b/browser/devtools/debugger/test/browser_dbg_file-reload.js @@ -20,7 +20,7 @@ function test() { is(gSources.itemCount, 1, "There should be one source displayed in the view.") - is(gSources.selectedValue, JS_URL, + is(getSelectedSourceURL(gSources), JS_URL, "The correct source is currently selected in the view."); ok(gEditor.getText().contains("bacon"), "The currently shown source contains bacon. Mmm, delicious!"); @@ -38,7 +38,7 @@ function test() { is(gSources.itemCount, 1, "There should be one source displayed in the view after reloading.") - is(gSources.selectedValue, JS_URL, + is(getSelectedSourceURL(gSources), JS_URL, "The correct source is currently selected in the view after reloading."); ok(gEditor.getText().contains("bacon"), "The newly shown source contains bacon. Mmm, delicious!"); diff --git a/browser/devtools/debugger/test/browser_dbg_iframes.js b/browser/devtools/debugger/test/browser_dbg_iframes.js index bb963d5e6329..b920a85a0d63 100644 --- a/browser/devtools/debugger/test/browser_dbg_iframes.js +++ b/browser/devtools/debugger/test/browser_dbg_iframes.js @@ -43,7 +43,7 @@ function test() { "Found the expected number of entries in the sources widget."); is(gEditor.getText().indexOf("debugger"), 348, "The correct source was loaded initially."); - is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", + is(getSelectedSourceURL(gSources), EXAMPLE_URL + "doc_inline-debugger-statement.html", "The currently selected source value is incorrect (0)."); is(gSources.selectedValue, gSources.values[0], "The currently selected source value is incorrect (1)."); diff --git a/browser/devtools/debugger/test/browser_dbg_interrupts.js b/browser/devtools/debugger/test/browser_dbg_interrupts.js index d2b08833a052..aedf876977ae 100644 --- a/browser/devtools/debugger/test/browser_dbg_interrupts.js +++ b/browser/devtools/debugger/test/browser_dbg_interrupts.js @@ -40,9 +40,9 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.values[0], line: 5 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 6 })) - .then(() => gPanel.addBreakpoint({ url: gSources.values[1], line: 7 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[0], line: 5 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 6 })) + .then(() => gPanel.addBreakpoint({ actor: gSources.values[1], line: 7 })) .then(() => ensureThreadClientState(gPanel, "resumed")); } diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js b/browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js index 4fc5abf3a0fb..b680b2ff3d17 100644 --- a/browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js +++ b/browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js @@ -37,7 +37,7 @@ function testLocationChange() { is(gSources.itemCount, 1, "Found the expected number of entries in the sources widget."); - is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", + is(getSelectedSourceURL(gSources), EXAMPLE_URL + "doc_inline-debugger-statement.html", "There should be a selected source value."); isnot(gEditor.getText().length, 0, "The source editor should have some text displayed."); diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-04-breakpoint.js b/browser/devtools/debugger/test/browser_dbg_location-changes-04-breakpoint.js index a79f3d110c1d..f3f37abd0933 100644 --- a/browser/devtools/debugger/test/browser_dbg_location-changes-04-breakpoint.js +++ b/browser/devtools/debugger/test/browser_dbg_location-changes-04-breakpoint.js @@ -35,13 +35,13 @@ function addBreakpoint() { testResume(); }); - gPanel.addBreakpoint({ url: SOURCE_URL, line: 5 }); + gPanel.addBreakpoint({ actor: getSourceActor(gSources, SOURCE_URL), line: 5 }); } function testResume() { is(gDebugger.gThreadClient.state, "paused", "The breakpoint wasn't hit yet (1)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (1)."); ok(isCaretPos(gPanel, 5), "The source editor caret position is incorrect (1)."); @@ -52,7 +52,7 @@ function testResume() { function testClick() { isnot(gDebugger.gThreadClient.state, "paused", "The breakpoint wasn't hit yet (2)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (2)."); ok(isCaretPos(gPanel, 5), "The source editor caret position is incorrect (2)."); @@ -73,8 +73,8 @@ function testClick() { function afterBreakpointHit() { is(gDebugger.gThreadClient.state, "paused", - "The breakpoint was hit (3)."); - is(gSources.selectedValue, SOURCE_URL, + "The breakpoint was hit (3)."); + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (3)."); ok(isCaretPos(gPanel, 5), "The source editor caret position is incorrect (3)."); @@ -94,7 +94,7 @@ function afterBreakpointHit() { function afterDebuggerStatementHit() { is(gDebugger.gThreadClient.state, "paused", "The debugger statement was hit (4)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (4)."); ok(isCaretPos(gPanel, 6), "The source editor caret position is incorrect (4)."); @@ -111,7 +111,7 @@ function afterDebuggerStatementHit() { function testClickAgain() { isnot(gDebugger.gThreadClient.state, "paused", "The breakpoint wasn't hit yet (5)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (5)."); ok(isCaretPos(gPanel, 1), "The source editor caret position is incorrect (5)."); @@ -133,7 +133,7 @@ function testClickAgain() { function afterBreakpointHitAgain() { is(gDebugger.gThreadClient.state, "paused", "The breakpoint was hit (6)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (6)."); ok(isCaretPos(gPanel, 5), "The source editor caret position is incorrect (6)."); @@ -153,7 +153,7 @@ function afterBreakpointHitAgain() { function afterDebuggerStatementHitAgain() { is(gDebugger.gThreadClient.state, "paused", "The debugger statement was hit (7)."); - is(gSources.selectedValue, SOURCE_URL, + is(getSelectedSourceURL(gSources), SOURCE_URL, "The currently shown source is incorrect (7)."); ok(isCaretPos(gPanel, 6), "The source editor caret position is incorrect (7)."); diff --git a/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js b/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js index e8aa910c7b1c..71abb24718e8 100644 --- a/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js +++ b/browser/devtools/debugger/test/browser_dbg_optimized-out-vars.js @@ -13,7 +13,8 @@ function test() { sources = gDebugger.DebuggerView.Sources; yield waitForSourceShown(panel, ".html"); - yield panel.addBreakpoint({ url: sources.values[0], line: 18 }); + yield panel.addBreakpoint({ actor: sources.values[0], + line: 18 }); yield ensureThreadClientState(panel, "resumed"); // Spin the event loop before causing the debuggee to pause, to allow diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-05.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-05.js index 8bc9eb0f8095..8bbaafdffb38 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-05.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-05.js @@ -27,7 +27,7 @@ function test() { ok(false, "The source editor text shouldn't have changed."); }); - is(gSources.selectedValue, TAB_URL, + is(getSelectedSourceURL(gSources), TAB_URL, "The correct source is currently selected."); ok(gEditor.getText().contains("myFunction"), "The source shouldn't be pretty printed yet."); @@ -45,7 +45,7 @@ function test() { let text; [source, text] = yield gControllerSources.getText(source); - is(gSources.selectedValue, TAB_URL, + is(getSelectedSourceURL(gSources), TAB_URL, "The correct source is still selected."); ok(gEditor.getText().contains("myFunction"), "The displayed source hasn't changed."); @@ -62,7 +62,10 @@ function clickPrettyPrintButton() { } function prepareDebugger(aPanel) { - aPanel._view.Sources.preferredSource = TAB_URL; + aPanel._view.Sources.preferredSource = getSourceActor( + aPanel.panelWin.DebuggerView.Sources, + TAB_URL + ); } registerCleanupFunction(function() { diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-06.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-06.js index d4c5a9b45b46..48f866935427 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-06.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-06.js @@ -43,7 +43,7 @@ function test() { ok(false, "The source editor text shouldn't have changed."); }); - is(gSources.selectedValue, JS_URL, + is(getSelectedSourceURL(gSources), JS_URL, "The correct source is currently selected."); ok(gEditor.getText().contains("myFunction"), "The source shouldn't be pretty printed yet."); @@ -61,7 +61,7 @@ function test() { let text; [source, text] = yield gControllerSources.getText(source); - is(gSources.selectedValue, JS_URL, + is(getSelectedSourceURL(gSources), JS_URL, "The correct source is still selected."); ok(gEditor.getText().contains("myFunction"), "The displayed source hasn't changed."); diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-08.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-08.js index 613917812e93..50c1f1c9bb8b 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-08.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-08.js @@ -19,8 +19,6 @@ function test() { }); } -let CODE_URL; - const BP_LOCATION = { line: 5, column: 11 @@ -28,11 +26,11 @@ const BP_LOCATION = { function findSource() { gThreadClient.getSources(({ error, sources }) => { - ok(!error); + ok(!error, "error should exist"); sources = sources.filter(s => s.url.contains("code_ugly-3.js")); - is(sources.length, 1); + is(sources.length, 1, "sources.length should be 1"); [gSource] = sources; - CODE_URL = BP_LOCATION.url = gSource.url; + BP_LOCATION.actor = gSource.actor; prettyPrintSource(sources[0]); }); @@ -50,26 +48,30 @@ function runCode({ error }) { function testDbgStatement(event, { why, frame }) { is(why.type, "debuggerStatement"); - const { url, line, column } = frame.where; - is(url, CODE_URL); - is(line, 3); + const { source, line, column } = frame.where; + is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor"); + is(line, 3, "the line should be 3"); setBreakpoint(); } function setBreakpoint() { - gThreadClient.setBreakpoint(BP_LOCATION, ({ error, actualLocation }) => { - ok(!error); - ok(!actualLocation); - testStepping(); - }); + gThreadClient.source(gSource).setBreakpoint( + { line: BP_LOCATION.line, + column: BP_LOCATION.column }, + ({ error, actualLocation }) => { + ok(!error, "error should not exist"); + ok(!actualLocation, "actualLocation should not exist"); + testStepping(); + } + ); } function testStepping() { gClient.addOneTimeListener("paused", (event, { why, frame }) => { is(why.type, "resumeLimit"); - const { url, line } = frame.where; - is(url, CODE_URL); - is(line, 4); + const { source, line } = frame.where; + is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor"); + is(line, 4, "the line should be 4"); testHitBreakpoint(); }); gThreadClient.stepIn(); @@ -78,9 +80,9 @@ function testStepping() { function testHitBreakpoint() { gClient.addOneTimeListener("paused", (event, { why, frame }) => { is(why.type, "breakpoint"); - const { url, line } = frame.where; - is(url, CODE_URL); - is(line, BP_LOCATION.line); + const { source, line } = frame.where; + is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor"); + is(line, BP_LOCATION.line, "the line should the right line"); resumeDebuggerThenCloseAndFinish(gPanel); }); diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-09.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-09.js index 104448ee11dd..fdc5a779c901 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-09.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-09.js @@ -53,8 +53,8 @@ function runCode({ error }) { function testDbgStatement(event, { frame, why }) { is(why.type, "debuggerStatement"); - const { url, line } = frame.where; - is(url, B_URL); + const { source, line } = frame.where; + is(source.url, B_URL); is(line, 2); disablePrettyPrint(); @@ -75,8 +75,8 @@ function getFrame() { } function testFrame({ frames: [frame] }) { - const { url, line } = frame.where; - is(url, B_URL); + const { source, line } = frame.where; + is(source.url, B_URL); is(line, 1); resumeDebuggerThenCloseAndFinish(gPanel); diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-12.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-12.js index 68bf93d0fcfb..6e56640d6a64 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-12.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-12.js @@ -21,8 +21,8 @@ function test() { waitForSourceShown(gPanel, "") .then(() => { - let shown = ensureSourceIs(gPanel, TAB_URL, true) - gSources.selectedValue = TAB_URL; + let shown = ensureSourceIs(gPanel, TAB_URL, true); + gSources.selectedValue = getSourceActor(gSources, TAB_URL); return shown; }) .then(clickPrettyPrintButton) diff --git a/browser/devtools/debugger/test/browser_dbg_pretty-print-on-paused.js b/browser/devtools/debugger/test/browser_dbg_pretty-print-on-paused.js index 59e8859fb819..faba77e5c3c0 100644 --- a/browser/devtools/debugger/test/browser_dbg_pretty-print-on-paused.js +++ b/browser/devtools/debugger/test/browser_dbg_pretty-print-on-paused.js @@ -25,8 +25,9 @@ function test(){ yield ensureSourceIs(gPanel, "code_script-switching-02.js", true); yield doInterrupt(gPanel); - yield rdpInvoke(gThreadClient, gThreadClient.setBreakpoint, { - url: gSources.selectedValue, + + let source = gThreadClient.source(getSourceForm(gSources, SECOND_SOURCE_VALUE)); + yield rdpInvoke(source, source.setBreakpoint, { line: 6 }); yield doResume(gPanel); @@ -37,7 +38,7 @@ function test(){ info("Switch to the second source."); const sourceShown = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE); - gSources.selectedValue = SECOND_SOURCE_VALUE; + gSources.selectedValue = getSourceActor(gSources, SECOND_SOURCE_VALUE); yield sourceShown; info("Pretty print the source."); diff --git a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-01.js b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-01.js index 70b3f968f7e8..c1a889bfb51a 100644 --- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-01.js +++ b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-01.js @@ -28,16 +28,17 @@ function finishTest() { info("Currently preferred source: " + gSources.preferredValue); info("Currently selected source: " + gSources.selectedValue); - is(gSources.preferredValue, PREFERRED_URL, + is(getSourceURL(gSources, gSources.preferredValue), PREFERRED_URL, "The preferred source url wasn't set correctly."); - is(gSources.selectedValue, PREFERRED_URL, + is(getSourceURL(gSources, gSources.selectedValue), PREFERRED_URL, "The selected source isn't the correct one."); closeDebuggerAndFinish(gPanel); } function prepareDebugger(aPanel) { - aPanel._view.Sources.preferredSource = PREFERRED_URL; + let sources = aPanel._view.Sources; + sources.preferredSource = getSourceActor(sources, PREFERRED_URL); } registerCleanupFunction(function() { diff --git a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js index d0b4848fa2d9..60fb571b59b5 100644 --- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js +++ b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-02.js @@ -20,7 +20,7 @@ function test() { gSources = gDebugger.DebuggerView.Sources; waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest); - gSources.preferredSource = PREFERRED_URL; + gSources.preferredSource = getSourceActor(gSources, PREFERRED_URL); }); } @@ -28,9 +28,9 @@ function finishTest() { info("Currently preferred source: " + gSources.preferredValue); info("Currently selected source: " + gSources.selectedValue); - is(gSources.preferredValue, PREFERRED_URL, + is(getSourceURL(gSources, gSources.preferredValue), PREFERRED_URL, "The preferred source url wasn't set correctly."); - is(gSources.selectedValue, PREFERRED_URL, + is(getSourceURL(gSources, gSources.selectedValue), PREFERRED_URL, "The selected source isn't the correct one."); closeDebuggerAndFinish(gPanel); diff --git a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js index df8abf6f0d7a..01cd51869079 100644 --- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js +++ b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script-03.js @@ -21,7 +21,7 @@ function test() { gSources = gDebugger.DebuggerView.Sources; waitForSourceShown(gPanel, FIRST_URL) - .then(() => testSource("", FIRST_URL)) + .then(() => testSource(undefined, FIRST_URL)) .then(() => switchToSource(SECOND_URL)) .then(() => testSource(SECOND_URL)) .then(() => switchToSource(FIRST_URL)) @@ -37,15 +37,15 @@ function testSource(aPreferredUrl, aSelectedUrl = aPreferredUrl) { info("Currently preferred source: " + gSources.preferredValue); info("Currently selected source: " + gSources.selectedValue); - is(gSources.preferredValue, aPreferredUrl, + is(getSourceURL(gSources, gSources.preferredValue), aPreferredUrl, "The preferred source url wasn't set correctly."); - is(gSources.selectedValue, aSelectedUrl, + is(getSourceURL(gSources, gSources.selectedValue), aSelectedUrl, "The selected source isn't the correct one."); } function switchToSource(aUrl) { let finished = waitForSourceShown(gPanel, aUrl); - gSources.preferredSource = aUrl; + gSources.preferredSource = getSourceActor(gSources, aUrl); return finished; } diff --git a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js b/browser/devtools/debugger/test/browser_dbg_reload-same-script.js index 79c7a25d0132..e03505458b63 100644 --- a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js +++ b/browser/devtools/debugger/test/browser_dbg_reload-same-script.js @@ -29,7 +29,7 @@ function test() { function performTest() { switch (gStep++) { case 0: - testCurrentSource(FIRST_URL, ""); + testCurrentSource(FIRST_URL, null); reload().then(performTest); break; case 1: @@ -61,7 +61,7 @@ function test() { function switchAndReload(aUrl) { let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(reload); - gSources.selectedValue = aUrl; + gSources.selectedValue = getSourceActor(gSources, aUrl); return finished; } @@ -69,9 +69,9 @@ function test() { info("Currently preferred source: '" + gSources.preferredValue + "'."); info("Currently selected source: '" + gSources.selectedValue + "'."); - is(gSources.preferredValue, aExpectedUrl, + is(getSourceURL(gSources, gSources.preferredValue), aExpectedUrl, "The preferred source url wasn't set correctly (" + gStep + ")."); - is(gSources.selectedValue, aUrl, + is(getSourceURL(gSources, gSources.selectedValue), aUrl, "The selected source isn't the correct one (" + gStep + ")."); } } diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js index a62c6beb8c7e..f2202bd2dace 100644 --- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js +++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js @@ -51,9 +51,9 @@ function testSourcesDisplay() { EXAMPLE_URL + "code_script-switching-02.js", "The correct tooltip text is displayed for the second source."); - ok(gSources.containsValue(EXAMPLE_URL + gLabel1), + ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1), "First source url is incorrect."); - ok(gSources.containsValue(EXAMPLE_URL + gLabel2), + ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2), "Second source url is incorrect."); ok(gSources.getItemForAttachment(e => e.label == gLabel1), @@ -63,12 +63,12 @@ function testSourcesDisplay() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel2, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); ok(gDebugger.document.title.endsWith(EXAMPLE_URL + gLabel2), @@ -79,9 +79,9 @@ function testSourcesDisplay() { // The editor's debug location takes a tick to update. executeSoon(() => { - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 5, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(5, "debug-line"), "The debugged line is highlighted appropriately (1)."); waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); @@ -96,7 +96,7 @@ function testSwitchPaused1() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel1, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), 118, @@ -125,31 +125,28 @@ function testSwitchPaused2() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel2, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); // The editor's debug location takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "Editor caret location is correct."); - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 5, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(5, "debug-line"), "The debugged line is highlighted appropriately (2)."); - // Step out three times. + // Step out twice. waitForThreadEvents(gPanel, "paused").then(() => { - waitForThreadEvents(gPanel, "paused").then(() => { - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); - gDebugger.gThreadClient.stepOut(); - }); + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); gDebugger.gThreadClient.stepOut(); - }); + }) gDebugger.gThreadClient.stepOut(); }); @@ -161,7 +158,7 @@ function testSwitchRunning() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel1, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), 118, @@ -171,11 +168,11 @@ function testSwitchRunning() { // The editor's debug location takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 5), "Editor caret location is correct."); - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 4, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(4, "debug-line"), "The debugged line is highlighted appropriately (3)."); deferred.resolve(); diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js index 7acfc38d16b1..a1cdade16e2e 100644 --- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js +++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js @@ -42,9 +42,9 @@ function testSourcesDisplay() { is(gSources.itemCount, 2, "Found the expected number of sources."); - ok(gSources.containsValue(EXAMPLE_URL + gLabel1), + ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1), "First source url is incorrect."); - ok(gSources.containsValue(EXAMPLE_URL + gLabel2 + gParams), + ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2 + gParams), "Second source url is incorrect."); ok(gSources.getItemForAttachment(e => e.label == gLabel1), @@ -54,12 +54,12 @@ function testSourcesDisplay() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel2 + gParams, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); ok(isCaretPos(gPanel, 1), @@ -67,9 +67,9 @@ function testSourcesDisplay() { // The editor's debug location takes a tick to update. executeSoon(() => { - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 5, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(5, "debug-line"), "The debugged line is highlighted appropriately."); waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); @@ -84,7 +84,7 @@ function testSwitchPaused1() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel1, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), 118, @@ -114,29 +114,26 @@ function testSwitchPaused2() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel2 + gParams, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); // The editor's debug location takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "Editor caret location is correct."); - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 5, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(5, "debug-line"), "The debugged line is highlighted appropriately."); // Step out three times. waitForThreadEvents(gPanel, "paused").then(() => { - waitForThreadEvents(gPanel, "paused").then(() => { - waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); - gDebugger.gThreadClient.stepOut(); - }); + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve); gDebugger.gThreadClient.stepOut(); }); gDebugger.gThreadClient.stepOut(); @@ -150,7 +147,7 @@ function testSwitchRunning() { ok(gSources.selectedItem, "There should be a selected item in the sources pane."); - is(gSources.selectedValue, EXAMPLE_URL + gLabel1, + is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1, "The selected value is the sources pane is incorrect."); is(gEditor.getText().search(/firstCall/), 118, @@ -160,11 +157,11 @@ function testSwitchRunning() { // The editor's debug location takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 5), "Editor caret location is correct."); - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 4, "Editor debugger location is correct."); - ok(gEditor.hasLineClass(0, "debug-line"), + ok(gEditor.hasLineClass(4, "debug-line"), "The debugged line is highlighted appropriately."); deferred.resolve(); diff --git a/browser/devtools/debugger/test/browser_dbg_search-basic-02.js b/browser/devtools/debugger/test/browser_dbg_search-basic-02.js index f454d1b33642..c933b6f3aab5 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-basic-02.js +++ b/browser/devtools/debugger/test/browser_dbg_search-basic-02.js @@ -105,7 +105,7 @@ function combineWithTokenColonSearch() { function verifySourceAndCaret(aUrl, aLine, aColumn, aSelection) { ok(gSources.selectedItem.attachment.label.contains(aUrl), "The selected item's label appears to be correct."); - ok(gSources.selectedItem.value.contains(aUrl), + ok(gSources.selectedItem.attachment.source.url.contains(aUrl), "The selected item's value appears to be correct."); ok(isCaretPos(gPanel, aLine, aColumn), "The current caret position appears to be correct."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-basic-03.js b/browser/devtools/debugger/test/browser_dbg_search-basic-03.js index bfdfa81c5c62..74020e8e4bad 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-basic-03.js +++ b/browser/devtools/debugger/test/browser_dbg_search-basic-03.js @@ -103,7 +103,7 @@ function escapeAndClear() { function verifySourceAndCaret(aUrl, aLine, aColumn) { ok(gSources.selectedItem.attachment.label.contains(aUrl), "The selected item's label appears to be correct."); - ok(gSources.selectedItem.value.contains(aUrl), + ok(gSources.selectedItem.attachment.source.url.contains(aUrl), "The selected item's value appears to be correct."); ok(isCaretPos(gPanel, aLine, aColumn), "The current caret position appears to be correct."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-basic-04.js b/browser/devtools/debugger/test/browser_dbg_search-basic-04.js index 372a360bb81b..be115654bfa1 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-basic-04.js +++ b/browser/devtools/debugger/test/browser_dbg_search-basic-04.js @@ -34,7 +34,7 @@ function testLineSearch() { setText(gSearchBox, ":42"); ok(isCaretPos(gPanel, 7), "The editor caret position appears to be correct (1.1)."); - ok(isEditorSel(gPanel, [160, 160]), + ok(isEditorSel(gPanel, [151, 151]), "The editor selection appears to be correct (1.1)."); is(gEditor.getSelection(), "", "The editor selected text appears to be correct (1.1)."); @@ -76,43 +76,43 @@ function testLineSearch() { } function testTokenSearch() { - setText(gSearchBox, "#;\""); - ok(isCaretPos(gPanel, 5, 23), + setText(gSearchBox, "#();"); + ok(isCaretPos(gPanel, 5, 16), "The editor caret position appears to be correct (2.1)."); - ok(isEditorSel(gPanel, [153, 155]), + ok(isEditorSel(gPanel, [145, 148]), "The editor selection appears to be correct (2.1)."); - is(gEditor.getSelection(), ";\"", + is(gEditor.getSelection(), "();", "The editor selected text appears to be correct (2.1)."); backspaceText(gSearchBox, 1); - ok(isCaretPos(gPanel, 5, 22), + ok(isCaretPos(gPanel, 4, 21), "The editor caret position appears to be correct (2.2)."); - ok(isEditorSel(gPanel, [153, 154]), + ok(isEditorSel(gPanel, [128, 130]), "The editor selection appears to be correct (2.2)."); - is(gEditor.getSelection(), ";", + is(gEditor.getSelection(), "()", "The editor selected text appears to be correct (2.2)."); - backspaceText(gSearchBox, 1); - ok(isCaretPos(gPanel, 5, 22), + backspaceText(gSearchBox, 2); + ok(isCaretPos(gPanel, 4, 20), "The editor caret position appears to be correct (2.3)."); - ok(isEditorSel(gPanel, [154, 154]), + ok(isEditorSel(gPanel, [129, 129]), "The editor selection appears to be correct (2.3)."); is(gEditor.getSelection(), "", "The editor selected text appears to be correct (2.3)."); setText(gSearchBox, "#;"); - ok(isCaretPos(gPanel, 5, 22), + ok(isCaretPos(gPanel, 5, 16), "The editor caret position appears to be correct (2.4)."); - ok(isEditorSel(gPanel, [153, 154]), + ok(isEditorSel(gPanel, [147, 148]), "The editor selection appears to be correct (2.4)."); is(gEditor.getSelection(), ";", "The editor selected text appears to be correct (2.4)."); gSearchBox.select(); backspaceText(gSearchBox, 1); - ok(isCaretPos(gPanel, 5, 22), + ok(isCaretPos(gPanel, 5, 16), "The editor caret position appears to be correct (2.5)."); - ok(isEditorSel(gPanel, [154, 154]), + ok(isEditorSel(gPanel, [148, 148]), "The editor selection appears to be correct (2.5)."); is(gEditor.getSelection(), "", "The editor selected text appears to be correct (2.5)."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-01.js b/browser/devtools/debugger/test/browser_dbg_search-global-01.js index 907bf9c48817..265ff92f6723 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-01.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-01.js @@ -48,12 +48,12 @@ function firstSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -134,9 +134,9 @@ function firstSearch() { is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2, "The second result for the second source doesn't have the correct number of non-matches in a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), ' eval("', + is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), ' ', "The second result for the second source doesn't have the correct non-matches in a line."); - is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), 'bugger;");', + is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), 'bugger;', "The second result for the second source doesn't have the correct non-matches in a line."); deferred.resolve(); @@ -162,12 +162,12 @@ function secondSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-02.js b/browser/devtools/debugger/test/browser_dbg_search-global-02.js index a5a0fd5d0c95..64d6f3c46549 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-02.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-02.js @@ -51,12 +51,12 @@ function firstSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -65,7 +65,7 @@ function firstSearch() { }); }); - setText(gSearchBox, "!eval"); + setText(gSearchBox, "!function"); return deferred.promise; } @@ -73,20 +73,20 @@ function firstSearch() { function doFirstJump() { let deferred = promise.defer(); - waitForSourceAndCaret(gPanel, "-01.js", 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + waitForSourceAndCaret(gPanel, "-01.js", 4).then(() => { + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(gSources.selectedValue.contains("-01.js"), + ok(getSelectedSourceURL(gSources).contains("-01.js"), "The currently shown source is incorrect (1)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (1)."); // The editor's selected text takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 5, 7), + ok(isCaretPos(gPanel, 4, 9), "The editor didn't jump to the correct line (1)."); - is(gEditor.getSelection(), "eval", + is(gEditor.getSelection(), "function", "The editor didn't select the correct text (1)."); deferred.resolve(); @@ -101,20 +101,20 @@ function doFirstJump() { function doSecondJump() { let deferred = promise.defer(); - waitForSourceAndCaret(gPanel, "-02.js", 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + waitForSourceAndCaret(gPanel, "-02.js", 4).then(() => { + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The currently shown source is incorrect (2)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (2)."); // The editor's selected text takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 6, 7), + ok(isCaretPos(gPanel, 4, 9), "The editor didn't jump to the correct line (2)."); - is(gEditor.getSelection(), "eval", + is(gEditor.getSelection(), "function", "The editor didn't select the correct text (2)."); deferred.resolve(); @@ -129,26 +129,27 @@ function doSecondJump() { function doWrapAroundJump() { let deferred = promise.defer(); - waitForSourceAndCaret(gPanel, "-01.js", 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + waitForSourceAndCaret(gPanel, "-01.js", 4).then(() => { + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(gSources.selectedValue.contains("-01.js"), + ok(getSelectedSourceURL(gSources).contains("-01.js"), "The currently shown source is incorrect (3)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (3)."); // The editor's selected text takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 5, 7), + ok(isCaretPos(gPanel, 4, 9), "The editor didn't jump to the correct line (3)."); - is(gEditor.getSelection(), "eval", + is(gEditor.getSelection(), "function", "The editor didn't select the correct text (3)."); deferred.resolve(); }); }); + EventUtils.sendKey("DOWN", gDebugger); EventUtils.sendKey("DOWN", gDebugger); return deferred.promise; @@ -157,20 +158,20 @@ function doWrapAroundJump() { function doBackwardsWrapAroundJump() { let deferred = promise.defer(); - waitForSourceAndCaret(gPanel, "-02.js", 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + waitForSourceAndCaret(gPanel, "-02.js", 7).then(() => { + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The currently shown source is incorrect (4)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (4)."); // The editor's selected text takes a tick to update. executeSoon(() => { - ok(isCaretPos(gPanel, 6, 7), + ok(isCaretPos(gPanel, 7, 11), "The editor didn't jump to the correct line (4)."); - is(gEditor.getSelection(), "eval", + is(gEditor.getSelection(), "function", "The editor didn't select the correct text (4)."); deferred.resolve(); @@ -185,14 +186,14 @@ function doBackwardsWrapAroundJump() { function testSearchTokenEmpty() { backspaceText(gSearchBox, 4); - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The currently shown source is incorrect (4)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (4)."); - ok(isCaretPos(gPanel, 6, 7), + ok(isCaretPos(gPanel, 7, 11), "The editor didn't remain at the correct line (4)."); is(gEditor.getSelection(), "", "The editor shouldn't keep the previous text selected (4)."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-03.js b/browser/devtools/debugger/test/browser_dbg_search-global-03.js index be619be30ea8..5613f661bd78 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-03.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-03.js @@ -47,12 +47,12 @@ function firstSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -61,7 +61,7 @@ function firstSearch() { }); }); - setText(gSearchBox, "!eval"); + setText(gSearchBox, "!function"); return deferred.promise; } @@ -77,7 +77,7 @@ function performTest() { "The global search pane splitter should be visible from the previous search."); reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); is(gSearchView.itemCount, 0, diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-04.js b/browser/devtools/debugger/test/browser_dbg_search-global-04.js index 86138650847a..b22065bc8a56 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-04.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-04.js @@ -40,12 +40,12 @@ function firstSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -54,7 +54,7 @@ function firstSearch() { }); }); - setText(gSearchBox, "!eval"); + setText(gSearchBox, "!function"); return deferred.promise; } @@ -63,12 +63,12 @@ function secondSearch() { let deferred = promise.defer(); gDebugger.once(gDebugger.EVENTS.GLOBAL_SEARCH_MATCH_NOT_FOUND, () => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-05.js b/browser/devtools/debugger/test/browser_dbg_search-global-05.js index dec7575726df..c408e49c1a28 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-05.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-05.js @@ -43,12 +43,12 @@ function doSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -94,14 +94,14 @@ function testClickLineToJump() { let firstLine = sourceResults[0].querySelector(".dbg-results-line-contents"); waitForSourceAndCaret(gPanel, "-01.js", 1, 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); ok(isCaretPos(gPanel, 1, 1), "The editor didn't jump to the correct line (1)."); is(gEditor.getSelection(), "", "The editor didn't select the correct text (1)."); - ok(gSources.selectedValue.contains("-01.js"), + ok(getSelectedSourceURL(gSources).contains("-01.js"), "The currently shown source is incorrect (1)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (1)."); @@ -123,14 +123,14 @@ function testClickMatchToJump() { let lastMatch = Array.slice(secondMatches).pop(); waitForSourceAndCaret(gPanel, "-02.js", 1, 1).then(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); ok(isCaretPos(gPanel, 1, 1), "The editor didn't jump to the correct line (2)."); is(gEditor.getSelection(), "", "The editor didn't select the correct text (2)."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The currently shown source is incorrect (2)."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search (2)."); diff --git a/browser/devtools/debugger/test/browser_dbg_search-global-06.js b/browser/devtools/debugger/test/browser_dbg_search-global-06.js index a85e36c79153..578120a08c62 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-global-06.js +++ b/browser/devtools/debugger/test/browser_dbg_search-global-06.js @@ -49,12 +49,12 @@ function doSearch() { // Some operations are synchronously dispatched on the main thread, // to avoid blocking UI, thus giving the impression of faster searching. executeSoon(() => { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); - ok(isCaretPos(gPanel, 1), + ok(isCaretPos(gPanel, 6), "The editor shouldn't have jumped to a matching line yet."); - ok(gSources.selectedValue.contains("-02.js"), + ok(getSelectedSourceURL(gSources).contains("-02.js"), "The current source shouldn't have changed after a global search."); is(gSources.visibleItems.length, 2, "Not all the sources are shown after the global search."); @@ -78,7 +78,7 @@ function testFocusLost() { gDebugger.DebuggerView.editor.focus(); - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); is(gSearchView.itemCount, 0, diff --git a/browser/devtools/debugger/test/browser_dbg_search-popup-jank.js b/browser/devtools/debugger/test/browser_dbg_search-popup-jank.js index 8cceb8ca028f..e00d28933cda 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-popup-jank.js +++ b/browser/devtools/debugger/test/browser_dbg_search-popup-jank.js @@ -46,6 +46,7 @@ function test() { .then(() => ensureSourceIs(aPanel, "doc_editor-mode")) .then(() => ensureCaretAt(aPanel, 1)) .then(() => typeText(gSearchBox, ":")) + .then(() => waitForSourceShown(gPanel, "code_test-editor-mode")) .then(() => ensureSourceIs(aPanel, "code_test-editor-mode", true)) .then(() => ensureCaretAt(aPanel, 1)) .then(() => typeText(gSearchBox, "5")) diff --git a/browser/devtools/debugger/test/browser_dbg_search-sources-01.js b/browser/devtools/debugger/test/browser_dbg_search-sources-01.js index b9c82bb72736..cc2b6ff3af12 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-sources-01.js +++ b/browser/devtools/debugger/test/browser_dbg_search-sources-01.js @@ -108,11 +108,11 @@ function thirdSearch() { let finished = promise.all([ once(gDebugger, "popupshown"), waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND), - waitForCaretUpdated(gPanel, 6, 12) + waitForCaretUpdated(gPanel, 6, 6) ]) .then(() => promise.all([ ensureSourceIs(gPanel, "-02.js"), - ensureCaretAt(gPanel, 6, 12), + ensureCaretAt(gPanel, 6, 6), verifyContents({ itemCount: 1, hidden: false }) ])); diff --git a/browser/devtools/debugger/test/browser_dbg_search-symbols.js b/browser/devtools/debugger/test/browser_dbg_search-symbols.js index 325a54e817e1..803e51ef5c8a 100644 --- a/browser/devtools/debugger/test/browser_dbg_search-symbols.js +++ b/browser/devtools/debugger/test/browser_dbg_search-symbols.js @@ -52,7 +52,7 @@ function htmlSearch() { ok(gFilteredFunctions.selectedItem, "An item should be selected in the filtered functions view (2)."); - if (gSources.selectedValue.indexOf(".html") != -1) { + if (gSources.selectedItem.attachment.source.url.indexOf(".html") != -1) { let expectedResults = [ ["inline", ".html", "", 19, 16], ["arrow", ".html", "", 20, 11], @@ -117,7 +117,7 @@ function firstJsSearch() { ok(gFilteredFunctions.selectedItem, "An item should be selected in the filtered functions view (2)."); - if (gSources.selectedValue.indexOf("-01.js") != -1) { + if (gSources.selectedItem.attachment.source.url.indexOf("-01.js") != -1) { let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; let expectedResults = [ ["test", "-01.js", "", 4, 10], @@ -188,7 +188,7 @@ function secondJsSearch() { ok(gFilteredFunctions.selectedItem, "An item should be selected in the filtered functions view (2)."); - if (gSources.selectedValue.indexOf("-02.js") != -1) { + if (gSources.selectedItem.attachment.source.url.indexOf("-02.js") != -1) { let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; let expectedResults = [ ["test2", "-02.js", "", 4, 5], @@ -259,7 +259,7 @@ function thirdJsSearch() { ok(gFilteredFunctions.selectedItem, "An item should be selected in the filtered functions view (2)."); - if (gSources.selectedValue.indexOf("-03.js") != -1) { + if (gSources.selectedItem.attachment.source.url.indexOf("-03.js") != -1) { let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; let expectedResults = [ ["namedEventListener", "-03.js", "", 4, 43], @@ -330,7 +330,7 @@ function filterSearch() { ok(gFilteredFunctions.selectedItem, "An item should be selected in the filtered functions view (2)."); - if (gSources.selectedValue.indexOf("-03.js") != -1) { + if (gSources.selectedItem.attachment.source.url.indexOf("-03.js") != -1) { let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " "; let expectedResults = [ ["namedEventListener", "-03.js", "", 4, 43], @@ -452,7 +452,7 @@ function saveSearch() { } function writeInfo() { - info("Current source url:\n" + gSources.selectedValue); + info("Current source url:\n" + getSelectedSourceURL(gSources)); info("Debugger editor text:\n" + gEditor.getText()); } diff --git a/browser/devtools/debugger/test/browser_dbg_searchbox-help-popup-02.js b/browser/devtools/debugger/test/browser_dbg_searchbox-help-popup-02.js index 125d01cf18ed..f71951bc7250 100644 --- a/browser/devtools/debugger/test/browser_dbg_searchbox-help-popup-02.js +++ b/browser/devtools/debugger/test/browser_dbg_searchbox-help-popup-02.js @@ -63,9 +63,9 @@ function focusEditor() { } function testFocusLost() { - ok(isCaretPos(gPanel, 1, 1), + ok(isCaretPos(gPanel, 6, 1), "The editor caret position appears to be correct after gaining focus."); - ok(isEditorSel(gPanel, [1, 1]), + ok(isEditorSel(gPanel, [165, 165]), "The editor selection appears to be correct after gaining focus."); is(gEditor.getSelection(), "", "The editor selected text appears to be correct after gaining focus."); diff --git a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-01.js b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-01.js index b78cd3d62290..e6cf32590694 100644 --- a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-01.js +++ b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-01.js @@ -54,55 +54,55 @@ function test() { function addBreakpoints() { return promise.resolve(null) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 18, condition: "undefined" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 19, condition: "null" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 20, condition: "42" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 21, condition: "true" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 22, condition: "'nasu'" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 23, condition: "/regexp/" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 24, condition: "({})" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 25, condition: "(function() {})" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 26, condition: "(function() { return false; })()" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 27, condition: "a" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 28, condition: "a !== undefined" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 29, condition: "a !== null" })) - .then(() => gPanel.addBreakpoint({ url: gSources.selectedValue, + .then(() => gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 30, condition: "b" })); @@ -172,19 +172,19 @@ function test() { // Highlight the breakpoint only if required. if (aHighlightBreakpoint) { let finished = waitForCaretUpdated(gPanel, aLine).then(() => testBreakpoint(aLine)); - gSources.highlightBreakpoint({ url: gSources.selectedValue, line: aLine }); + gSources.highlightBreakpoint({ actor: gSources.selectedValue, line: aLine }); return finished; } - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane."); ok(selectedBreakpoint, "There should be a selected brekapoint in the sources pane."); - is(selectedBreakpoint.attachment.url, selectedUrl, + is(selectedBreakpoint.attachment.actor, selectedActor, "The breakpoint on line " + aLine + " wasn't added on the correct source."); is(selectedBreakpoint.attachment.line, aLine, "The breakpoint on line " + aLine + " wasn't found."); @@ -196,7 +196,7 @@ function test() { "The breakpoint conditional expression popup should not have been shown."); return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => { - is(aBreakpointClient.location.url, selectedUrl, + is(aBreakpointClient.location.actor, selectedActor, "The breakpoint's client url is correct"); is(aBreakpointClient.location.line, aLine, "The breakpoint's client line is correct"); @@ -209,10 +209,10 @@ function test() { } function testAfterReload() { - let selectedUrl = gSources.selectedValue; + let selectedActor = getSelectedSourceURL(gSources); let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane after reload."); ok(!selectedBreakpoint, "There should be no selected brekapoint in the sources pane after reload."); diff --git a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-02.js b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-02.js index 4cbcd820c0b3..1fad10177dc4 100644 --- a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-02.js +++ b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-02.js @@ -77,15 +77,15 @@ function test() { is(gEditor.getBreakpoints().length, 0, "No breakpoints currently shown in the editor."); - ok(!gBreakpoints._getAdded({ url: "foo", line: 3 }), + ok(!gBreakpoints._getAdded({ actor: "foo", line: 3 }), "_getAdded('foo', 3) returns falsey."); - ok(!gBreakpoints._getRemoving({ url: "bar", line: 3 }), + ok(!gBreakpoints._getRemoving({ actor: "bar", line: 3 }), "_getRemoving('bar', 3) returns falsey."); } function addBreakpoint1() { let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED); - gPanel.addBreakpoint({ url: gSources.selectedValue, line: 18 }); + gPanel.addBreakpoint({ actor: gSources.selectedValue, line: 18 }); return finished; } @@ -132,15 +132,15 @@ function test() { } function testBreakpoint(aLine, aOpenPopupFlag, aPopupVisible, aConditionalExpression) { - let selectedUrl = gSources.selectedValue; + let selectedActor = gSources.selectedValue; let selectedBreakpoint = gSources._selectedBreakpointItem; - ok(selectedUrl, + ok(selectedActor, "There should be a selected item in the sources pane."); ok(selectedBreakpoint, "There should be a selected brekapoint in the sources pane."); - is(selectedBreakpoint.attachment.url, selectedUrl, + is(selectedBreakpoint.attachment.actor, selectedActor, "The breakpoint on line " + aLine + " wasn't added on the correct source."); is(selectedBreakpoint.attachment.line, aLine, "The breakpoint on line " + aLine + " wasn't found."); @@ -152,7 +152,7 @@ function test() { "The breakpoint on line " + aLine + " should have a correct popup state (2)."); return gBreakpoints._getAdded(selectedBreakpoint.attachment).then(aBreakpointClient => { - is(aBreakpointClient.location.url, selectedUrl, + is(aBreakpointClient.location.actor, selectedActor, "The breakpoint's client url is correct"); is(aBreakpointClient.location.line, aLine, "The breakpoint's client line is correct"); @@ -167,7 +167,7 @@ function test() { } function testNoBreakpoint(aLine) { - let selectedUrl = gSources.selectedValue; + let selectedUrl = getSelectedSourceURL(gSources); let selectedBreakpoint = gSources._selectedBreakpointItem; ok(selectedUrl, diff --git a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-03.js b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-03.js index 189b48b01259..604320be664b 100644 --- a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-03.js +++ b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-03.js @@ -19,7 +19,7 @@ function test() { gSources = gDebugger.DebuggerView.Sources; gBreakpoints = gDebugger.DebuggerController.Breakpoints; - gLocation = { url: gSources.selectedValue, line: 18 }; + gLocation = { actor: gSources.selectedValue, line: 18 }; waitForSourceAndCaretAndScopes(gPanel, ".html", 17) .then(addBreakpoint) diff --git a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-04.js b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-04.js index 6f9cc008d236..43fc2e1b2552 100644 --- a/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-04.js +++ b/browser/devtools/debugger/test/browser_dbg_server-conditional-bp-04.js @@ -20,7 +20,7 @@ function test() { gSources = gDebugger.DebuggerView.Sources; gBreakpoints = gDebugger.DebuggerController.Breakpoints; - gLocation = { url: gSources.selectedValue, line: 18 }; + gLocation = { actor: gSources.selectedValue, line: 18 }; waitForSourceAndCaretAndScopes(gPanel, ".html", 17) .then(addBreakpoint) diff --git a/browser/devtools/debugger/test/browser_dbg_source-maps-01.js b/browser/devtools/debugger/test/browser_dbg_source-maps-01.js index 07e579eb4f22..4bbbb14be1a7 100644 --- a/browser/devtools/debugger/test/browser_dbg_source-maps-01.js +++ b/browser/devtools/debugger/test/browser_dbg_source-maps-01.js @@ -45,7 +45,7 @@ function checkSourceMapsEnabled() { } function checkInitialSource() { - isnot(gSources.selectedValue.indexOf(".coffee"), -1, + isnot(gSources.selectedItem.attachment.source.url.indexOf(".coffee"), -1, "The debugger should show the source mapped coffee source file."); is(gSources.selectedValue.indexOf(".js"), -1, "The debugger should not show the generated js source file."); @@ -57,9 +57,11 @@ function checkInitialSource() { function testSetBreakpoint() { let deferred = promise.defer(); + let sourceForm = getSourceForm(gSources, COFFEE_URL); gDebugger.gThreadClient.interrupt(aResponse => { - gDebugger.gThreadClient.setBreakpoint({ url: COFFEE_URL, line: 5 }, aResponse => { + let source = gDebugger.gThreadClient.source(sourceForm); + source.setBreakpoint({ line: 5 }, aResponse => { ok(!aResponse.error, "Should be able to set a breakpoint in a coffee source file."); ok(!aResponse.actualLocation, @@ -74,14 +76,16 @@ function testSetBreakpoint() { function testSetBreakpointBlankLine() { let deferred = promise.defer(); + let sourceForm = getSourceForm(gSources, COFFEE_URL); - gDebugger.gThreadClient.setBreakpoint({ url: COFFEE_URL, line: 3 }, aResponse => { + let source = gDebugger.gThreadClient.source(sourceForm); + source.setBreakpoint({ line: 3 }, aResponse => { ok(!aResponse.error, "Should be able to set a breakpoint in a coffee source file on a blank line."); ok(aResponse.actualLocation, "Because 3 is empty, we should have an actualLocation."); - is(aResponse.actualLocation.url, COFFEE_URL, - "actualLocation.url should be source mapped to the coffee file."); + is(aResponse.actualLocation.source.url, COFFEE_URL, + "actualLocation.actor should be source mapped to the coffee file."); is(aResponse.actualLocation.line, 2, "actualLocation.line should be source mapped back to 2."); diff --git a/browser/devtools/debugger/test/browser_dbg_source-maps-02.js b/browser/devtools/debugger/test/browser_dbg_source-maps-02.js index 569686884f57..433843475e00 100644 --- a/browser/devtools/debugger/test/browser_dbg_source-maps-02.js +++ b/browser/devtools/debugger/test/browser_dbg_source-maps-02.js @@ -41,9 +41,9 @@ function testToggleGeneratedSource() { is(gOptions._showOriginalSourceItem.getAttribute("checked"), "false", "Source maps should now be disabled.") - is(gSources.selectedValue.indexOf(".coffee"), -1, + is(gSources.selectedItem.attachment.source.url.indexOf(".coffee"), -1, "The debugger should not show the source mapped coffee source file."); - isnot(gSources.selectedValue.indexOf(".js"), -1, + isnot(gSources.selectedItem.attachment.source.url.indexOf(".js"), -1, "The debugger should show the generated js source file."); is(gEditor.getText().indexOf("isnt"), -1, @@ -61,8 +61,10 @@ function testToggleGeneratedSource() { function testSetBreakpoint() { let deferred = promise.defer(); + let sourceForm = getSourceForm(gSources, JS_URL); + let source = gDebugger.gThreadClient.source(sourceForm); - gDebugger.gThreadClient.setBreakpoint({ url: JS_URL, line: 7 }, aResponse => { + source.setBreakpoint({ line: 7 }, aResponse => { ok(!aResponse.error, "Should be able to set a breakpoint in a js file."); @@ -95,9 +97,9 @@ function testToggleOnPause() { is(gOptions._showOriginalSourceItem.getAttribute("checked"), "true", "Source maps should now be enabled.") - isnot(gSources.selectedValue.indexOf(".coffee"), -1, + isnot(gSources.selectedItem.attachment.source.url.indexOf(".coffee"), -1, "The debugger should show the source mapped coffee source file."); - is(gSources.selectedValue.indexOf(".js"), -1, + is(gSources.selectedItem.attachment.source.url.indexOf(".js"), -1, "The debugger should not show the generated js source file."); is(gEditor.getText().indexOf("isnt"), 218, diff --git a/browser/devtools/debugger/test/browser_dbg_source-maps-03.js b/browser/devtools/debugger/test/browser_dbg_source-maps-03.js index 560f0b545204..a7a48f361d4f 100644 --- a/browser/devtools/debugger/test/browser_dbg_source-maps-03.js +++ b/browser/devtools/debugger/test/browser_dbg_source-maps-03.js @@ -31,9 +31,9 @@ function test() { } function checkInitialSource() { - isnot(gSources.selectedValue.indexOf(".js"), -1, + isnot(gSources.selectedItem.attachment.source.url.indexOf(".js"), -1, "The debugger should not show the minified js file."); - is(gSources.selectedValue.indexOf(".min.js"), -1, + is(gSources.selectedItem.attachment.source.url.indexOf(".min.js"), -1, "The debugger should show the original js file."); is(gEditor.getText().split("\n").length, 46, "The debugger's editor should have the original source displayed, " + @@ -42,8 +42,10 @@ function checkInitialSource() { function testSetBreakpoint() { let deferred = promise.defer(); + let sourceForm = getSourceForm(gSources, JS_URL); + let source = gDebugger.gThreadClient.source(sourceForm); - gDebugger.gThreadClient.setBreakpoint({ url: JS_URL, line: 30, column: 21 }, aResponse => { + source.setBreakpoint({ line: 30, column: 21 }, aResponse => { ok(!aResponse.error, "Should be able to set a breakpoint in a js file."); ok(!aResponse.actualLocation, diff --git a/browser/devtools/debugger/test/browser_dbg_source-maps-04.js b/browser/devtools/debugger/test/browser_dbg_source-maps-04.js index f759c781a681..c74df7a00fe9 100644 --- a/browser/devtools/debugger/test/browser_dbg_source-maps-04.js +++ b/browser/devtools/debugger/test/browser_dbg_source-maps-04.js @@ -46,7 +46,7 @@ function test() { } function checkInitialSource() { - isnot(gSources.selectedValue.indexOf("code_math_bogus_map.js"), -1, + isnot(gSources.selectedItem.attachment.source.url.indexOf("code_math_bogus_map.js"), -1, "The debugger should show the minified js file."); } @@ -86,8 +86,10 @@ function disableIgnoreCaughtExceptions() { function testSetBreakpoint() { let deferred = promise.defer(); + let sourceForm = getSourceForm(gSources, JS_URL); + let source = gDebugger.gThreadClient.source(sourceForm); - gDebugger.gThreadClient.setBreakpoint({ url: JS_URL, line: 3, column: 61 }, aResponse => { + source.setBreakpoint({ line: 3, column: 61 }, aResponse => { ok(!aResponse.error, "Should be able to set a breakpoint in a js file."); ok(!aResponse.actualLocation, @@ -115,7 +117,17 @@ function testHitBreakpoint() { waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => { is(gFrames.itemCount, 1, "Should have one frame."); - gDebugger.gThreadClient.resume(deferred.resolve); + // This is weird, but we need to let the debugger a chance to + // update first + executeSoon(() => { + gDebugger.gThreadClient.resume(() => { + // We also need to make sure the next step doesn't add a + // "resumed" handler until this is completely finished + executeSoon(() => { + deferred.resolve(); + }); + }); + }); }); }); diff --git a/browser/devtools/debugger/test/browser_dbg_sources-cache.js b/browser/devtools/debugger/test/browser_dbg_sources-cache.js index 55c8e5687837..b838abf8def1 100644 --- a/browser/devtools/debugger/test/browser_dbg_sources-cache.js +++ b/browser/devtools/debugger/test/browser_dbg_sources-cache.js @@ -40,7 +40,7 @@ function initialChecks() { "Editor text contents appears to be correct."); is(gSources.selectedItem.attachment.label, "code_function-search-01.js", "The currently selected label in the sources container is correct."); - ok(gSources.selectedValue.contains("code_function-search-01.js"), + ok(getSelectedSourceURL(gSources).contains("code_function-search-01.js"), "The currently selected value in the sources container appears to be correct."); is(gSources.itemCount, TOTAL_SOURCES, @@ -57,22 +57,22 @@ function initialChecks() { is(gSources.attachments[0].label, "code_function-search-01.js", "The first source label is correct."); - ok(gSources.values[0].contains("code_function-search-01.js"), + ok(gSources.attachments[0].source.url.contains("code_function-search-01.js"), "The first source value appears to be correct."); is(gSources.attachments[1].label, "code_function-search-02.js", "The second source label is correct."); - ok(gSources.values[1].contains("code_function-search-02.js"), + ok(gSources.attachments[1].source.url.contains("code_function-search-02.js"), "The second source value appears to be correct."); is(gSources.attachments[2].label, "code_function-search-03.js", "The third source label is correct."); - ok(gSources.values[2].contains("code_function-search-03.js"), + ok(gSources.attachments[2].source.url.contains("code_function-search-03.js"), "The third source value appears to be correct."); is(gSources.attachments[3].label, "doc_function-search.html", "The third source label is correct."); - ok(gSources.values[3].contains("doc_function-search.html"), + ok(gSources.attachments[3].source.url.contains("doc_function-search.html"), "The third source value appears to be correct."); is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES, @@ -92,17 +92,17 @@ function performReloadAndTestState() { } function testCacheIntegrity(aSources) { - for (let [url, contents] of aSources) { + for (let [actor, contents] of aSources) { // Sources of a debugee don't always finish fetching consecutively. D'uh. - let index = gSources.values.indexOf(url); + let index = gSources.values.indexOf(actor); ok(index >= 0 && index <= TOTAL_SOURCES, - "Found a source url cached correctly (" + index + ")."); + "Found a source actor cached correctly (" + index + ")."); ok(contents.contains( ["First source!", "Second source!", "Third source!", "Peanut butter jelly time!"][index]), "Found a source's text contents cached correctly (" + index + ")."); - info("Cached source url at " + index + ": " + url); + info("Cached source actor at " + index + ": " + actor); info("Cached source text at " + index + ": " + contents); } } diff --git a/browser/devtools/debugger/test/browser_dbg_sources-eval.js b/browser/devtools/debugger/test/browser_dbg_sources-eval.js new file mode 100644 index 000000000000..6236f14eac37 --- /dev/null +++ b/browser/devtools/debugger/test/browser_dbg_sources-eval.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Make sure eval scripts appear in the source list + */ + +const TAB_URL = EXAMPLE_URL + "doc_script-eval.html"; + +function test() { + let gTab, gPanel, gDebugger; + let gSources, gBreakpoints; + + initDebugger(TAB_URL).then(([aTab,, aPanel]) => { + gTab = aTab; + gPanel = aPanel; + gDebugger = gPanel.panelWin; + gSources = gDebugger.DebuggerView.Sources; + gBreakpoints = gDebugger.DebuggerController.Breakpoints; + + waitForSourceShown(gPanel, "-eval.js") + .then(run) + .then(null, aError => { + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); + }); + }); + + function run() { + return Task.spawn(function*() { + is(gSources.values.length, 1, "Should have 1 source"); + + let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE); + callInTab(gTab, "evalSource"); + yield newSource; + + is(gSources.values.length, 2, "Should have 2 sources"); + + yield closeDebuggerAndFinish(gPanel); + }); + } +} diff --git a/browser/devtools/debugger/test/browser_dbg_sources-labels.js b/browser/devtools/debugger/test/browser_dbg_sources-labels.js index 14b7debe8d98..31ff8e1749b0 100644 --- a/browser/devtools/debugger/test/browser_dbg_sources-labels.js +++ b/browser/devtools/debugger/test/browser_dbg_sources-labels.js @@ -72,28 +72,21 @@ function test() { "The first item in the sources widget should be selected (1)."); is(gSources.selectedItem.attachment.label, "doc_recursion-stack.html", "The first item in the sources widget should be selected (2)."); - is(gSources.selectedValue, TAB_URL, + is(getSelectedSourceURL(gSources), TAB_URL, "The first item in the sources widget should be selected (3)."); - gSources.empty(); - - is(gSources.itemCount, 0, - "Should contain no items in the sources widget after emptying."); - is(gSources.selectedIndex, -1, - "No item in the sources widget should be selected (1)."); - is(gSources.selectedItem, null, - "No item in the sources widget should be selected (2)."); - is(gSources.selectedValue, "", - "No item in the sources widget should be selected (3)."); - + let id = 0; for (let { href, leaf } of urls) { let url = href + leaf; + let actor = 'actor' + id++; let label = gUtils.trimUrlLength(gUtils.getSourceLabel(url)); let group = gUtils.getSourceGroup(url); let dummy = document.createElement("label"); + dummy.setAttribute('value', label); - gSources.push([dummy, url], { + gSources.push([dummy, actor], { attachment: { + source: { actor: actor, url: url }, label: label, group: group } @@ -109,9 +102,9 @@ function test() { for (let { href, leaf, dupe } of urls) { let url = href + leaf; if (dupe) { - ok(!gSources.containsValue(url), "Shouldn't contain source: " + url); + ok(!gSources.containsValue(getSourceActor(gSources, url)), "Shouldn't contain source: " + url); } else { - ok(gSources.containsValue(url), "Should contain source: " + url); + ok(gSources.containsValue(getSourceActor(gSources, url)), "Should contain source: " + url); } } @@ -151,20 +144,20 @@ function test() { ok(gSources.getItemForAttachment(e => e.label == nananana + "Batman!" + ellipsis), "Source (15) label is incorrect."); - is(gSources.itemCount, urls.filter(({ dupe }) => !dupe).length, + is(gSources.itemCount, urls.filter(({ dupe }) => !dupe).length + 1, "Didn't get the correct number of sources in the list."); - is(gSources.getItemByValue("http://some.address.com/random/subrandom/").attachment.label, + is(gSources.getItemByValue(getSourceActor(gSources, "http://some.address.com/random/subrandom/")).attachment.label, "random/subrandom/", "gSources.getItemByValue isn't functioning properly (0)."); - is(gSources.getItemByValue("http://some.address.com/random/suprandom/?a=1").attachment.label, + is(gSources.getItemByValue(getSourceActor(gSources, "http://some.address.com/random/suprandom/?a=1")).attachment.label, "random/suprandom/?a=1", "gSources.getItemByValue isn't functioning properly (1)."); - is(gSources.getItemForAttachment(e => e.label == "random/subrandom/").value, - "http://some.address.com/random/subrandom/", + is(gSources.getItemForAttachment(e => e.label == "random/subrandom/").attachment.source.url, + "http://some.address.com/random/subrandom/", "gSources.getItemForAttachment isn't functioning properly (0)."); - is(gSources.getItemForAttachment(e => e.label == "random/suprandom/?a=1").value, + is(gSources.getItemForAttachment(e => e.label == "random/suprandom/?a=1").attachment.source.url, "http://some.address.com/random/suprandom/?a=1", "gSources.getItemForAttachment isn't functioning properly (1)."); diff --git a/browser/devtools/debugger/test/browser_dbg_sources-sorting.js b/browser/devtools/debugger/test/browser_dbg_sources-sorting.js index d6a830e65361..89ab6db51392 100644 --- a/browser/devtools/debugger/test/browser_dbg_sources-sorting.js +++ b/browser/devtools/debugger/test/browser_dbg_sources-sorting.js @@ -18,19 +18,15 @@ function test() { gSources = gDebugger.DebuggerView.Sources; gUtils = gDebugger.SourceUtils; - waitForSourceShown(gPanel, ".html").then(() => { - addSourceAndCheckOrder(1, () => { - addSourceAndCheckOrder(2, () => { - addSourceAndCheckOrder(3, () => { - closeDebuggerAndFinish(gPanel); - }); - }); - }); - }); + waitForSourceShown(gPanel, ".html") + .then(addSourceAndCheckOrder.bind(null, 1)) + .then(addSourceAndCheckOrder.bind(null, 2)) + .then(addSourceAndCheckOrder.bind(null, 3)) + .then(() => { closeDebuggerAndFinish(gPanel); }); }); } -function addSourceAndCheckOrder(aMethod, aCallback) { +function addSourceAndCheckOrder(aMethod) { gSources.empty(); gSources.suppressSelectionEvents = true; @@ -49,13 +45,16 @@ function addSourceAndCheckOrder(aMethod, aCallback) { return Math.random() - 0.5; }); + let id = 0; + switch (aMethod) { case 1: for (let { href, leaf } of urls) { let url = href + leaf; + let actor = 'actor' + id++; let label = gUtils.getSourceLabel(url); let dummy = document.createElement("label"); - gSources.push([dummy, url], { + gSources.push([dummy, actor], { staged: true, attachment: { label: label @@ -68,9 +67,10 @@ function addSourceAndCheckOrder(aMethod, aCallback) { case 2: for (let { href, leaf } of urls) { let url = href + leaf; + let actor = 'actor' + id++; let label = gUtils.getSourceLabel(url); let dummy = document.createElement("label"); - gSources.push([dummy, url], { + gSources.push([dummy, actor], { staged: false, attachment: { label: label @@ -84,9 +84,10 @@ function addSourceAndCheckOrder(aMethod, aCallback) { for (; i < urls.length / 2; i++) { let { href, leaf } = urls[i]; let url = href + leaf; + let actor = 'actor' + id++; let label = gUtils.getSourceLabel(url); let dummy = document.createElement("label"); - gSources.push([dummy, url], { + gSources.push([dummy, actor], { staged: true, attachment: { label: label @@ -98,9 +99,10 @@ function addSourceAndCheckOrder(aMethod, aCallback) { for (; i < urls.length; i++) { let { href, leaf } = urls[i]; let url = href + leaf; + let actor = 'actor' + id++; let label = gUtils.getSourceLabel(url); let dummy = document.createElement("label"); - gSources.push([dummy, url], { + gSources.push([dummy, actor], { staged: false, attachment: { label: label @@ -111,7 +113,6 @@ function addSourceAndCheckOrder(aMethod, aCallback) { } checkSourcesOrder(aMethod); - aCallback(); } function checkSourcesOrder(aMethod) { diff --git a/browser/devtools/debugger/test/browser_dbg_split-console-paused-reload.js b/browser/devtools/debugger/test/browser_dbg_split-console-paused-reload.js index ff65d53b89c9..70037b94f9cd 100644 --- a/browser/devtools/debugger/test/browser_dbg_split-console-paused-reload.js +++ b/browser/devtools/debugger/test/browser_dbg_split-console-paused-reload.js @@ -11,13 +11,14 @@ function test() { } function* runTests() { - const TAB_URL = EXAMPLE_URL + "doc_split-console-paused-reload.html"; + let TAB_URL = EXAMPLE_URL + "doc_split-console-paused-reload.html"; let [,, panel] = yield initDebugger(TAB_URL); let dbgWin = panel.panelWin; + let sources = dbgWin.DebuggerView.Sources; let frames = dbgWin.DebuggerView.StackFrames; let toolbox = gDevTools.getToolbox(panel.target); - yield panel.addBreakpoint({ url: TAB_URL, line: 16 }); + yield panel.addBreakpoint({ actor: getSourceActor(sources, TAB_URL), line: 16 }); info("Breakpoint was set."); dbgWin.DebuggerController._target.activeTab.reload(); info("Page reloaded."); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-02.js b/browser/devtools/debugger/test/browser_dbg_stack-02.js index 3563871a80bb..229f39139b74 100644 --- a/browser/devtools/debugger/test/browser_dbg_stack-02.js +++ b/browser/devtools/debugger/test/browser_dbg_stack-02.js @@ -41,7 +41,7 @@ function performTest() { is(gFrames.getItemAtIndex(1).attachment.title, "(eval)", "Newest frame name should be correct."); is(gFrames.getItemAtIndex(1).attachment.url, - TAB_URL, "Newest frame url should be correct."); + TAB_URL, "Newest frame url should be correct."); is(gClassicFrames.getItemAtIndex(1).attachment.depth, 1, "Newest frame name is mirrored correctly."); diff --git a/browser/devtools/debugger/test/browser_dbg_stack-05.js b/browser/devtools/debugger/test/browser_dbg_stack-05.js index 4aca6c9b711a..45f61bc18777 100644 --- a/browser/devtools/debugger/test/browser_dbg_stack-05.js +++ b/browser/devtools/debugger/test/browser_dbg_stack-05.js @@ -23,8 +23,8 @@ function test() { waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1) .then(initialChecks) - .then(testNewestTwoFrames) - .then(testOldestTwoFrames) + .then(testNewestFrame) + .then(testOldestFrame) .then(testAfterResume) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { @@ -38,16 +38,16 @@ function test() { function initialChecks() { is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused."); - is(gFrames.itemCount, 4, + is(gFrames.itemCount, 2, "Should have four frames."); - is(gClassicFrames.itemCount, 4, + is(gClassicFrames.itemCount, 2, "Should also have four frames in the mirrored view."); } -function testNewestTwoFrames() { +function testNewestFrame() { let deferred = promise.defer(); - is(gFrames.selectedIndex, 3, + is(gFrames.selectedIndex, 1, "Newest frame should be selected by default."); is(gClassicFrames.selectedIndex, 0, "Newest frame should be selected in the mirrored view as well."); @@ -58,77 +58,39 @@ function testNewestTwoFrames() { // The editor's debug location takes a tick to update. executeSoon(() => { - is(gEditor.getDebugLocation(), 0, + is(gEditor.getDebugLocation(), 5, "Editor debug location is correct."); - EventUtils.sendMouseEvent({ type: "mousedown" }, - gFrames.getItemAtIndex(2).target, - gDebugger); + deferred.resolve(); + }); - is(gFrames.selectedIndex, 2, - "Third frame should be selected after click."); + return deferred.promise; +} + +function testOldestFrame() { + let deferred = promise.defer(); + + waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => { + is(gFrames.selectedIndex, 0, + "Second frame should be selected after click."); is(gClassicFrames.selectedIndex, 1, - "Third frame should be selected in the mirrored view as well."); - is(gSources.selectedIndex, 1, - "The second source is still selected in the widget."); - ok(isCaretPos(gPanel, 6), - "Editor caret location is correct (2)."); + "Second frame should be selected in the mirrored view as well."); + is(gSources.selectedIndex, 0, + "The first source is now selected in the widget."); + ok(isCaretPos(gPanel, 5), + "Editor caret location is correct (3)."); // The editor's debug location takes a tick to update. executeSoon(() => { - is(gEditor.getDebugLocation(), 5, + is(gEditor.getDebugLocation(), 4, "Editor debug location is correct."); deferred.resolve(); }); }); - return deferred.promise; -} - -function testOldestTwoFrames() { - let deferred = promise.defer(); - - waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => { - is(gFrames.selectedIndex, 1, - "Second frame should be selected after click."); - is(gClassicFrames.selectedIndex, 2, - "Second frame should be selected in the mirrored view as well."); - is(gSources.selectedIndex, 0, - "The first source is now selected in the widget."); - ok(isCaretPos(gPanel, 1), - "Editor caret location is correct (3)."); - - // The editor's debug location takes a tick to update. - executeSoon(() => { - is(gEditor.getDebugLocation(), 0, - "Editor debug location is correct."); - - EventUtils.sendMouseEvent({ type: "mousedown" }, - gFrames.getItemAtIndex(0).target, - gDebugger); - - is(gFrames.selectedIndex, 0, - "Oldest frame should be selected after click."); - is(gClassicFrames.selectedIndex, 3, - "Oldest frame should be selected in the mirrored view as well."); - is(gSources.selectedIndex, 0, - "The first source is still selected in the widget."); - ok(isCaretPos(gPanel, 5), - "Editor caret location is correct (4)."); - - // The editor's debug location takes a tick to update. - executeSoon(() => { - is(gEditor.getDebugLocation(), 4, - "Editor debug location is correct."); - - deferred.resolve(); - }); - }); - }); - EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.querySelector("#stackframe-2"), + gDebugger.document.querySelector("#stackframe-1"), gDebugger); return deferred.promise; diff --git a/browser/devtools/debugger/test/browser_dbg_stack-06.js b/browser/devtools/debugger/test/browser_dbg_stack-06.js index 94bc47a401f8..6bf4ca7d0659 100644 --- a/browser/devtools/debugger/test/browser_dbg_stack-06.js +++ b/browser/devtools/debugger/test/browser_dbg_stack-06.js @@ -27,7 +27,7 @@ function test() { } function performTest() { - is(gFrames.selectedIndex, 3, + is(gFrames.selectedIndex, 1, "Newest frame should be selected by default."); is(gClassicFrames.selectedIndex, 0, "Newest frame should also be selected in the mirrored view."); @@ -35,13 +35,13 @@ function performTest() { "The second source is selected in the widget."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => { is(gFrames.selectedIndex, 0, "Oldest frame should be selected after click."); - is(gClassicFrames.selectedIndex, 3, + is(gClassicFrames.selectedIndex, 1, "Oldest frame should also be selected in the mirrored view."); is(gSources.selectedIndex, 0, "The first source is now selected in the widget."); @@ -51,7 +51,7 @@ function performTest() { "The second source is not displayed."); waitForSourceAndCaret(gPanel, "-02.js", 1).then(waitForTick).then(() => { - is(gFrames.selectedIndex, 3, + is(gFrames.selectedIndex, 1, "Newest frame should be selected again after click."); is(gClassicFrames.selectedIndex, 0, "Newest frame should also be selected again in the mirrored view."); @@ -59,7 +59,7 @@ function performTest() { "The second source is selected in the widget."); is(gEditor.getText().search(/firstCall/), -1, "The first source is not displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The second source is displayed."); resumeDebuggerThenCloseAndFinish(gPanel); @@ -71,7 +71,7 @@ function performTest() { }); EventUtils.sendMouseEvent({ type: "mousedown" }, - gDebugger.document.querySelector("#stackframe-3"), + gDebugger.document.querySelector("#stackframe-1"), gDebugger); } diff --git a/browser/devtools/debugger/test/browser_dbg_stack-07.js b/browser/devtools/debugger/test/browser_dbg_stack-07.js index f02ebe6d5d92..d17f958c5848 100644 --- a/browser/devtools/debugger/test/browser_dbg_stack-07.js +++ b/browser/devtools/debugger/test/browser_dbg_stack-07.js @@ -31,22 +31,22 @@ function test() { function performTest() { return Task.spawn(function() { yield selectBottomFrame(); - testBottomFrame(0); + testBottomFrame(4); yield performStep("StepOver"); - testTopFrame(3); + testTopFrame(1); yield selectBottomFrame(); testBottomFrame(4); yield performStep("StepIn"); - testTopFrame(2); + testTopFrame(1); yield selectBottomFrame(); testBottomFrame(4); yield performStep("StepOut"); - testTopFrame(2); + testTopFrame(1); yield resumeDebuggerThenCloseAndFinish(gPanel); }); @@ -90,7 +90,7 @@ function performTest() { "The second source is now selected in the widget."); is(gEditor.getText().search(/firstCall/), -1, "The second source is displayed."); - is(gEditor.getText().search(/debugger/), 172, + is(gEditor.getText().search(/debugger/), 166, "The first source is not displayed."); } } diff --git a/browser/devtools/debugger/test/browser_dbg_tracing-03.js b/browser/devtools/debugger/test/browser_dbg_tracing-03.js index 99cb641a0379..e8bcbe8f913c 100644 --- a/browser/devtools/debugger/test/browser_dbg_tracing-03.js +++ b/browser/devtools/debugger/test/browser_dbg_tracing-03.js @@ -1,13 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +SimpleTest.requestCompleteLog(); + /** * Test that we can jump to function definitions by clicking on logs. */ const TAB_URL = EXAMPLE_URL + "doc_tracing-01.html"; -let gTab, gPanel, gDebugger; +let gTab, gPanel, gDebugger, gSources; function test() { SpecialPowers.pushPrefEnv({'set': [["devtools.debugger.tracer", true]]}, () => { @@ -15,16 +17,17 @@ function test() { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; + gSources = gDebugger.DebuggerView.Sources; waitForSourceShown(gPanel, "code_tracing-01.js") .then(() => startTracing(gPanel)) - .then(clickButton) + .then(() => clickButton()) .then(() => waitForClientEvents(aPanel, "traces")) .then(() => { // Switch away from the JS file so we can make sure that clicking on a // log will switch us back to the correct JS file. - aPanel.panelWin.DebuggerView.Sources.selectedValue = TAB_URL; - return ensureSourceIs(aPanel, TAB_URL, true); + gSources.selectedValue = getSourceActor(gSources, TAB_URL); + return ensureSourceIs(aPanel, getSourceActor(gSources, TAB_URL), true); }) .then(() => { const finished = waitForSourceShown(gPanel, "code_tracing-01.js"); @@ -63,4 +66,5 @@ registerCleanupFunction(function() { gTab = null; gPanel = null; gDebugger = null; + gSources = null; }); diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js index 3e2f69c2927c..ce9c74eef0e6 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js @@ -40,7 +40,7 @@ function test() { } function addBreakpoint() { - return gBreakpoints.addBreakpoint({ url: gSources.selectedValue, line: 21 }); + return gBreakpoints.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); } function pauseDebuggee() { diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-02.js b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-02.js index e7bb7b1a35ec..1afa7370fb35 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-02.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-02.js @@ -41,7 +41,7 @@ function test() { } function addBreakpoint() { - return gBreakpoints.addBreakpoint({ url: gSources.selectedValue, line: 21 }); + return gBreakpoints.addBreakpoint({ actor: gSources.selectedValue, line: 21 }); } function pauseDebuggee() { diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-03.js b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-03.js index a3e585e83130..2b94674eb9d5 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-03.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-03.js @@ -40,7 +40,7 @@ function test() { } function addBreakpoint() { - return gBreakpoints.addBreakpoint({ url: gSources.selectedValue, line: 18 }); + return gBreakpoints.addBreakpoint({ actor: gSources.selectedValue, line: 18 }); } function pauseDebuggee() { diff --git a/browser/devtools/debugger/test/code_math_bogus_map.js b/browser/devtools/debugger/test/code_math_bogus_map.js index 82e156b10cd6..af13defcfd1a 100644 --- a/browser/devtools/debugger/test/code_math_bogus_map.js +++ b/browser/devtools/debugger/test/code_math_bogus_map.js @@ -1,4 +1,4 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ function stopMe(){throw Error("boom");}try{stopMe();var a=1;a=a*2;}catch(e){}; -//# sourceMappingURL=bogus.map + diff --git a/browser/devtools/debugger/test/code_script-eval.js b/browser/devtools/debugger/test/code_script-eval.js new file mode 100644 index 000000000000..e27cb83f7b70 --- /dev/null +++ b/browser/devtools/debugger/test/code_script-eval.js @@ -0,0 +1,6 @@ + +var bar; + +function evalSource() { + eval('bar = function() {\nvar x = 5;\n}'); +} diff --git a/browser/devtools/debugger/test/code_script-switching-01.js b/browser/devtools/debugger/test/code_script-switching-01.js index a4c078032c04..4ba2772deb35 100644 --- a/browser/devtools/debugger/test/code_script-switching-01.js +++ b/browser/devtools/debugger/test/code_script-switching-01.js @@ -2,5 +2,5 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ function firstCall() { - eval("secondCall();"); + secondCall(); } diff --git a/browser/devtools/debugger/test/code_script-switching-02.js b/browser/devtools/debugger/test/code_script-switching-02.js index b378a57658e7..feb74315fc86 100644 --- a/browser/devtools/debugger/test/code_script-switching-02.js +++ b/browser/devtools/debugger/test/code_script-switching-02.js @@ -3,7 +3,7 @@ function secondCall() { // This comment is useful: ☺ - eval("debugger;"); + debugger; function foo() {} if (x) { foo(); diff --git a/browser/devtools/debugger/test/code_test-editor-mode b/browser/devtools/debugger/test/code_test-editor-mode index a86191c986f8..ca8a90889770 100644 --- a/browser/devtools/debugger/test/code_test-editor-mode +++ b/browser/devtools/debugger/test/code_test-editor-mode @@ -2,5 +2,5 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ function secondCall() { - eval("debugger;"); + debugger; } diff --git a/browser/devtools/debugger/test/doc_cmd-break.html b/browser/devtools/debugger/test/doc_cmd-break.html index 33a895f2d874..4f434746e0b9 100644 --- a/browser/devtools/debugger/test/doc_cmd-break.html +++ b/browser/devtools/debugger/test/doc_cmd-break.html @@ -11,10 +11,10 @@ diff --git a/browser/devtools/debugger/test/doc_script-eval.html b/browser/devtools/debugger/test/doc_script-eval.html new file mode 100644 index 000000000000..6084cbedfe8b --- /dev/null +++ b/browser/devtools/debugger/test/doc_script-eval.html @@ -0,0 +1,17 @@ + + + + + + + Debugger test page + + + + + + + + + diff --git a/browser/devtools/debugger/test/doc_tracing-01.html b/browser/devtools/debugger/test/doc_tracing-01.html index 9e200d305972..be3c7af1bdb9 100644 --- a/browser/devtools/debugger/test/doc_tracing-01.html +++ b/browser/devtools/debugger/test/doc_tracing-01.html @@ -8,5 +8,13 @@ + + diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js index 4d7fb26ea916..a21547810e64 100644 --- a/browser/devtools/debugger/test/head.js +++ b/browser/devtools/debugger/test/head.js @@ -246,7 +246,7 @@ function waitForTime(aDelay) { function waitForSourceShown(aPanel, aUrl) { return waitForDebuggerEvents(aPanel, aPanel.panelWin.EVENTS.SOURCE_SHOWN).then(aSource => { - let sourceUrl = aSource.url; + let sourceUrl = aSource.url || aSource.introductionUrl; info("Source shown: " + sourceUrl); if (!sourceUrl.contains(aUrl)) { @@ -261,15 +261,18 @@ function waitForEditorLocationSet(aPanel) { return waitForDebuggerEvents(aPanel, aPanel.panelWin.EVENTS.EDITOR_LOCATION_SET); } -function ensureSourceIs(aPanel, aUrl, aWaitFlag = false) { - if (aPanel.panelWin.DebuggerView.Sources.selectedValue.contains(aUrl)) { - ok(true, "Expected source is shown: " + aUrl); +function ensureSourceIs(aPanel, aUrlOrSource, aWaitFlag = false) { + let sources = aPanel.panelWin.DebuggerView.Sources; + + if (sources.selectedValue === aUrlOrSource || + sources.selectedItem.attachment.source.url.contains(aUrlOrSource)) { + ok(true, "Expected source is shown: " + aUrlOrSource); return promise.resolve(null); } if (aWaitFlag) { - return waitForSourceShown(aPanel, aUrl); + return waitForSourceShown(aPanel, aUrlOrSource); } - ok(false, "Expected source was not already shown: " + aUrl); + ok(false, "Expected source was not already shown: " + aUrlOrSource); return promise.reject(null); } @@ -658,7 +661,7 @@ AddonDebugger.prototype = { } for (let source of sources) { - let { label, group } = debuggerWin.DebuggerView.Sources.getItemByValue(source.url).attachment; + let { label, group } = debuggerWin.DebuggerView.Sources.getItemByValue(source.actor).attachment; if (!groupmap.has(group)) { ok(false, "Saw a source group not in the UI: " + group); @@ -776,13 +779,14 @@ function toggleBlackBoxing(aPanel, aSource = null) { return blackBoxChanged; } -function selectSourceAndGetBlackBoxButton(aPanel, aSource) { +function selectSourceAndGetBlackBoxButton(aPanel, aUrl) { function returnBlackboxButton() { return getBlackBoxButton(aPanel); } - aPanel.panelWin.DebuggerView.Sources.selectedValue = aSource; - return ensureSourceIs(aPanel, aSource, true).then(returnBlackboxButton); + let sources = aPanel.panelWin.DebuggerView.Sources; + sources.selectedValue = getSourceActor(sources, aUrl); + return ensureSourceIs(aPanel, aUrl, true).then(returnBlackboxButton); } // Variables view inspection popup helpers @@ -982,3 +986,25 @@ function sendMouseClickToTab(tab, target) { target: target }); } + +// Source helpers + +function getSelectedSourceURL(aSources) { + return (aSources.selectedItem && + aSources.selectedItem.attachment.source.url); +} + +function getSourceURL(aSources, aActor) { + let item = aSources.getItemByValue(aActor); + return item && item.attachment.source.url; +} + +function getSourceActor(aSources, aURL) { + let item = aSources.getItemForAttachment(a => a.source.url === aURL); + return item && item.value; +} + +function getSourceForm(aSources, aURL) { + let item = aSources.getItemByValue(getSourceActor(gSources, aURL)); + return item.attachment.source; +} diff --git a/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-01.js b/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-01.js index 1303a84df6b3..c3cca28693ef 100644 --- a/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-01.js +++ b/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-01.js @@ -18,8 +18,9 @@ let test = Task.async(function*() { ok(debuggerPanel, "The debugger panel was opened."); let { DebuggerView } = debuggerPanel.panelWin; + let Sources = DebuggerView.Sources; - is(DebuggerView.Sources.selectedValue, SIMPLE_URL, + is(Sources.selectedValue, getSourceActor(Sources, SIMPLE_URL), "The correct source is shown in the debugger."); is(DebuggerView.editor.getCursor().line + 1, 14, "The correct line is highlighted in the debugger's source editor."); diff --git a/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-02.js b/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-02.js index 7330a680b2b2..d119b411b4a2 100644 --- a/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-02.js +++ b/browser/devtools/profiler/test/browser_profiler_jump-to-debugger-02.js @@ -12,11 +12,12 @@ let test = Task.async(function*() { let debuggerWin = debuggerPanel.panelWin; let debuggerEvents = debuggerWin.EVENTS; let { DebuggerView } = debuggerWin; + let Sources = DebuggerView.Sources; yield debuggerWin.once(debuggerEvents.SOURCE_SHOWN); ok("A source was shown in the debugger."); - is(DebuggerView.Sources.selectedValue, SIMPLE_URL, + is(Sources.selectedValue, getSourceActor(Sources, SIMPLE_URL), "The correct source is initially shown in the debugger."); is(DebuggerView.editor.getCursor().line, 0, "The correct line is initially highlighted in the debugger's source editor."); @@ -33,7 +34,7 @@ let test = Task.async(function*() { debuggerPanel = toolbox.getPanel("jsdebugger"); ok(debuggerPanel, "The debugger panel was reselected."); - is(DebuggerView.Sources.selectedValue, SIMPLE_URL, + is(DebuggerView.Sources.selectedValue, getSourceActor(Sources, SIMPLE_URL), "The correct source is still shown in the debugger."); is(DebuggerView.editor.getCursor().line + 1, 14, "The correct line is now highlighted in the debugger's source editor."); diff --git a/browser/devtools/profiler/test/head.js b/browser/devtools/profiler/test/head.js index 354e3612622c..5e4dd0b87cee 100644 --- a/browser/devtools/profiler/test/head.js +++ b/browser/devtools/profiler/test/head.js @@ -158,3 +158,8 @@ function* stopRecording(panel, { waitForDisplay }) { "The record button should not be locked anymore."); } } + +function getSourceActor(aSources, aURL) { + let item = aSources.getItemForAttachment(a => a.source.url === aURL); + return item && item.value; +} diff --git a/browser/devtools/profiler/ui-profile.js b/browser/devtools/profiler/ui-profile.js index 7cbd9dc13579..9f65ed277929 100644 --- a/browser/devtools/profiler/ui-profile.js +++ b/browser/devtools/profiler/ui-profile.js @@ -808,8 +808,9 @@ function findLastIndex(array, predicate) { */ function viewSourceInDebugger(url, line) { let showSource = ({ DebuggerView }) => { - if (DebuggerView.Sources.containsValue(url)) { - DebuggerView.setEditorLocation(url, line, { noDebug: true }).then(() => { + let item = DebuggerView.Sources.getItemForAttachment(a => a.source.url === url); + if (item) { + DebuggerView.setEditorLocation(item.attachment.source.actor, line, { noDebug: true }).then(() => { window.emit(EVENTS.SOURCE_SHOWN_IN_JS_DEBUGGER); }, () => { window.emit(EVENTS.SOURCE_NOT_FOUND_IN_JS_DEBUGGER); diff --git a/browser/devtools/shared/widgets/Tooltip.js b/browser/devtools/shared/widgets/Tooltip.js index 21a0c33794d9..022864b66311 100644 --- a/browser/devtools/shared/widgets/Tooltip.js +++ b/browser/devtools/shared/widgets/Tooltip.js @@ -1336,8 +1336,12 @@ EventTooltip.prototype = { line = matches[2]; } - if (DebuggerView.Sources.containsValue(uri)) { - DebuggerView.setEditorLocation(uri, line, {noDebug: true}).then(() => { + let item = DebuggerView.Sources.getItemForAttachment( + a => a.source.url === uri + ); + if (item) { + let actor = item.attachment.source.actor; + DebuggerView.setEditorLocation(actor, line, {noDebug: true}).then(() => { if (dom0) { let text = DebuggerView.editor.getText(); let index = text.indexOf(searchString); diff --git a/browser/devtools/webconsole/hudservice.js b/browser/devtools/webconsole/hudservice.js index 87495654add3..61ebbaf13e8a 100644 --- a/browser/devtools/webconsole/hudservice.js +++ b/browser/devtools/webconsole/hudservice.js @@ -486,8 +486,11 @@ WebConsole.prototype = { } let showSource = ({ DebuggerView }) => { - if (DebuggerView.Sources.containsValue(aSourceURL)) { - DebuggerView.setEditorLocation(aSourceURL, aSourceLine, + let item = DebuggerView.Sources.getItemForAttachment( + a => a.source.url === aSourceURL + ); + if (item) { + DebuggerView.setEditorLocation(item.attachment.source.actor, aSourceLine, { noDebug: true }).then(() => { this.ui.emit("source-in-debugger-opened"); }); diff --git a/browser/devtools/webconsole/test/browser_console_optimized_out_vars.js b/browser/devtools/webconsole/test/browser_console_optimized_out_vars.js index 92f7bc8bce4a..c3eceedf0dbf 100644 --- a/browser/devtools/webconsole/test/browser_console_optimized_out_vars.js +++ b/browser/devtools/webconsole/test/browser_console_optimized_out_vars.js @@ -15,7 +15,7 @@ function test() { ok(true, "Debugger resumed"); let sources = panelWin.DebuggerView.Sources; - yield panel.addBreakpoint({ url: sources.values[0], line: 18 }); + yield panel.addBreakpoint({ actor: sources.values[0], line: 18 }); yield ensureThreadClientState(panel, "resumed"); let fetchedScopes = panelWin.once(panelWin.EVENTS.FETCHED_SCOPES); diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js b/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js index 85053e6f5cd6..2f2b10947328 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js @@ -69,7 +69,9 @@ function test() { let toolbox = yield gDevTools.getToolbox(hud.target); let {panelWin: { DebuggerView: view }} = toolbox.getPanel("jsdebugger"); - is(view.Sources.selectedValue, url, "expected source url"); + is(view.Sources.selectedValue, + getSourceActor(view.Sources, url), + "expected source url"); is(view.editor.getCursor().line, line - 1, "expected source line"); } } diff --git a/browser/devtools/webconsole/test/browser_webconsole_view_source.js b/browser/devtools/webconsole/test/browser_webconsole_view_source.js index a646e5bcae6b..33d364166aa3 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_view_source.js +++ b/browser/devtools/webconsole/test/browser_webconsole_view_source.js @@ -6,9 +6,9 @@ const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html"; -let containsValue; +let getItemForAttachment; let Sources; -let containsValueInvoked = false; +let getItemInvoked = false; function test() { addTab(TEST_URI); @@ -52,9 +52,9 @@ function testViewSource(hud) { Services.ww.registerNotification(observer); - containsValue = Sources.containsValue; - Sources.containsValue = () => { - containsValueInvoked = true; + getItemForAttachment = Sources.getItemForAttachment; + Sources.getItemForAttachment = () => { + getItemInvoked = true; return false; }; @@ -72,9 +72,9 @@ let observer = { "the location node"); aSubject.close(); - ok(containsValueInvoked, "custom containsValue() was invoked"); - Sources.containsValue = containsValue; - Sources = containsValue = null; + ok(getItemInvoked, "custom getItemForAttachment() was invoked"); + Sources.getItemForAttachment = getItemForAttachment; + Sources = getItemForAttachment = null; finishTest(); } }; diff --git a/browser/devtools/webconsole/test/head.js b/browser/devtools/webconsole/test/head.js index 90f9d42be401..800efcab1bd1 100644 --- a/browser/devtools/webconsole/test/head.js +++ b/browser/devtools/webconsole/test/head.js @@ -1663,3 +1663,7 @@ function once(target, eventName, useCapture=false) { return deferred.promise; } +function getSourceActor(aSources, aURL) { + let item = aSources.getItemForAttachment(a => a.source.url === aURL); + return item && item.value; +} diff --git a/toolkit/devtools/DevToolsUtils.js b/toolkit/devtools/DevToolsUtils.js index 03adf7f03cbb..82aee1efd369 100644 --- a/toolkit/devtools/DevToolsUtils.js +++ b/toolkit/devtools/DevToolsUtils.js @@ -342,22 +342,37 @@ exports.dbg_assert = function dbg_assert(cond, e) { /** - * Utility function for updating an object with the properties of another - * object. + * Utility function for updating an object with the properties of + * other objects. * * @param aTarget Object * The object being updated. * @param aNewAttrs Object - * The new attributes being set on the target. + * The rest params are objects to update aTarget with. You + * can pass as many as you like. */ -exports.update = function update(aTarget, aNewAttrs) { - for (let key in aNewAttrs) { - let desc = Object.getOwnPropertyDescriptor(aNewAttrs, key); +exports.update = function update(aTarget, ...aArgs) { + for (let attrs of aArgs) { + for (let key in attrs) { + let desc = Object.getOwnPropertyDescriptor(attrs, key); - if (desc) { - Object.defineProperty(aTarget, key, desc); + if (desc) { + Object.defineProperty(aTarget, key, desc); + } } } + + return aTarget; +} + +/** + * Utility function for getting the values from an object as an array + * + * @param aObject Object + * The object to iterate over + */ +exports.values = function values(aObject) { + return Object.keys(aObject).map(k => aObject[k]); } /** @@ -444,8 +459,6 @@ exports.fetch = function fetch(aURL, aOptions={ loadFromCache: true }) { scheme = Services.io.extractScheme(url); } - dump('scheme: ' + scheme); - switch (scheme) { case "file": case "chrome": diff --git a/toolkit/devtools/client/dbg-client.jsm b/toolkit/devtools/client/dbg-client.jsm index ddc221610da5..59fcb0085afb 100644 --- a/toolkit/devtools/client/dbg-client.jsm +++ b/toolkit/devtools/client/dbg-client.jsm @@ -57,6 +57,7 @@ Object.defineProperty(this, "WebConsoleClient", { Components.utils.import("resource://gre/modules/devtools/DevToolsUtils.jsm"); this.makeInfallible = DevToolsUtils.makeInfallible; +this.values = DevToolsUtils.values; let LOG_PREF = "devtools.debugger.log"; let VERBOSE_PREF = "devtools.debugger.log.verbose"; @@ -1609,72 +1610,6 @@ ThreadClient.prototype = { telemetry: "THREADDETACH" }), - /** - * Request to set a breakpoint in the specified location. - * - * @param object aLocation - * The source location object where the breakpoint will be set. - * @param function aOnResponse - * Called with the thread's response. - */ - setBreakpoint: function ({ url, line, column, condition }, - aOnResponse = noop) { - // A helper function that sets the breakpoint. - let doSetBreakpoint = (aCallback) => { - const location = { - url: url, - line: line, - column: column - }; - - let packet = { - to: this._actor, - type: "setBreakpoint", - location: location, - condition: condition - }; - this.client.request(packet, (aResponse) => { - // Ignoring errors, since the user may be setting a breakpoint in a - // dead script that will reappear on a page reload. - let bpClient; - if (aResponse.actor) { - let root = this.client.mainRoot; - bpClient = new BreakpointClient( - this.client, - aResponse.actor, - location, - root.traits.conditionalBreakpoints ? condition : undefined - ); - } - aOnResponse(aResponse, bpClient); - if (aCallback) { - aCallback(); - } - }); - }; - - // If the debuggee is paused, just set the breakpoint. - if (this.paused) { - doSetBreakpoint(); - return; - } - // Otherwise, force a pause in order to set the breakpoint. - this.interrupt((aResponse) => { - if (aResponse.error) { - // Can't set the breakpoint if pausing failed. - aOnResponse(aResponse); - return; - } - - const { type, why } = aResponse; - const cleanUp = type == "paused" && why.type == "interrupted" - ? () => this.resume() - : noop; - - doSetBreakpoint(cleanUp); - }); - }, - /** * Release multiple thread-lifetime object actors. If any pause-lifetime * actors are included in the request, a |notReleasable| error will return, @@ -1798,7 +1733,20 @@ ThreadClient.prototype = { return; } - for each (let frame in aResponse.frames) { + let threadGrips = values(this._threadGrips); + + for (let i in aResponse.frames) { + let frame = aResponse.frames[i]; + if (!frame.where.source) { + // Older servers use urls instead, so we need to resolve + // them to source actors + for (let grip of threadGrips) { + if (grip instanceof SourceClient && grip.url === frame.url) { + frame.where.source = grip._form; + } + } + } + this._frameCache[frame.depth] = frame; } @@ -2389,6 +2337,80 @@ SourceClient.prototype = { contentType: contentType }); }); + }, + + /** + * Request to set a breakpoint in the specified location. + * + * @param object aLocation + * The location and condition of the breakpoint in + * the form of { line[, column, condition] }. + * @param function aOnResponse + * Called with the thread's response. + */ + setBreakpoint: function ({ line, column, condition }, aOnResponse = noop) { + // A helper function that sets the breakpoint. + let doSetBreakpoint = aCallback => { + let root = this._client.mainRoot; + let location = { + line: line, + column: column + }; + + let packet = { + to: this.actor, + type: "setBreakpoint", + location: location, + condition: condition + }; + + // Backwards compatibility: send the breakpoint request to the + // thread if the server doesn't support Debugger.Source actors. + if (!root.traits.debuggerSourceActors) { + packet.to = this._activeThread.actor; + packet.location.url = this.url; + } + + this._client.request(packet, aResponse => { + // Ignoring errors, since the user may be setting a breakpoint in a + // dead script that will reappear on a page reload. + let bpClient; + if (aResponse.actor) { + bpClient = new BreakpointClient( + this._client, + this, + aResponse.actor, + location, + root.traits.conditionalBreakpoints ? condition : undefined + ); + } + aOnResponse(aResponse, bpClient); + if (aCallback) { + aCallback(); + } + }); + }; + + // If the debuggee is paused, just set the breakpoint. + if (this._activeThread.paused) { + doSetBreakpoint(); + return; + } + // Otherwise, force a pause in order to set the breakpoint. + this._activeThread.interrupt(aResponse => { + if (aResponse.error) { + // Can't set the breakpoint if pausing failed. + aOnResponse(aResponse); + return; + } + + const { type, why } = aResponse; + const cleanUp = type == "paused" && why.type == "interrupted" + ? () => this._activeThread.resume() + : noop; + + doSetBreakpoint(cleanUp); + }) } }; @@ -2397,6 +2419,8 @@ SourceClient.prototype = { * * @param aClient DebuggerClient * The debugger client parent. + * @param aSourceClient SourceClient + * The source where this breakpoint exists * @param aActor string * The actor ID for this breakpoint. * @param aLocation object @@ -2405,10 +2429,13 @@ SourceClient.prototype = { * @param aCondition string * The conditional expression of the breakpoint */ -function BreakpointClient(aClient, aActor, aLocation, aCondition) { +function BreakpointClient(aClient, aSourceClient, aActor, aLocation, aCondition) { this._client = aClient; this._actor = aActor; this.location = aLocation; + this.location.actor = aSourceClient.actor; + this.location.url = aSourceClient.url; + this.source = aSourceClient; this.request = this._client.request; // The condition property should only exist if it's a truthy value @@ -2471,7 +2498,6 @@ BreakpointClient.prototype = { if (root.traits.conditionalBreakpoints) { let info = { - url: this.location.url, line: this.location.line, column: this.location.column, condition: aCondition @@ -2485,7 +2511,7 @@ BreakpointClient.prototype = { return; } - gThreadClient.setBreakpoint(info, (aResponse, aNewBreakpoint) => { + this.source.setBreakpoint(info, (aResponse, aNewBreakpoint) => { if (aResponse && aResponse.error) { deferred.reject(aResponse); } else { @@ -2495,7 +2521,7 @@ BreakpointClient.prototype = { }); } else { // The property shouldn't even exist if the condition is blank - if(aCondition === "") { + if (aCondition === "") { delete this.conditionalExpression; } else { diff --git a/toolkit/devtools/server/actors/root.js b/toolkit/devtools/server/actors/root.js index f4c2ecf2f365..a1198dc1646d 100644 --- a/toolkit/devtools/server/actors/root.js +++ b/toolkit/devtools/server/actors/root.js @@ -146,6 +146,9 @@ RootActor.prototype = { storageInspectorReadOnly: true, // Whether conditional breakpoints are supported conditionalBreakpoints: true, + // Whether the server supports full source actors (breakpoints on + // eval scripts, etc) + debuggerSourceActors: true, bulk: true, // Whether the style rule actor implements the modifySelector method // that modifies the rule's selector diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index fb3aed6a25c6..85f9bd733dc3 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -98,7 +98,7 @@ BreakpointStore.prototype = { * @param Object aBreakpoint * The breakpoint to be added (not copied). It is an object with the * following properties: - * - url + * - source * - line * - column (optional; omission implies that the breakpoint is for * the whole line) @@ -108,30 +108,32 @@ BreakpointStore.prototype = { * The new or existing breakpoint. */ addBreakpoint: function (aBreakpoint) { - let { url, line, column } = aBreakpoint; + let { source: { actor }, line, column } = aBreakpoint; if (column != null) { - if (!this._breakpoints[url]) { - this._breakpoints[url] = []; + if (!this._breakpoints[actor]) { + this._breakpoints[actor] = []; } - if (!this._breakpoints[url][line]) { - this._breakpoints[url][line] = []; + if (!this._breakpoints[actor][line]) { + this._breakpoints[actor][line] = []; } - if (!this._breakpoints[url][line][column]) { - this._breakpoints[url][line][column] = aBreakpoint; + + if (!this._breakpoints[actor][line][column]) { + this._breakpoints[actor][line][column] = aBreakpoint; this._size++; } - return this._breakpoints[url][line][column]; + return this._breakpoints[actor][line][column]; } else { // Add a breakpoint that breaks on the whole line. - if (!this._wholeLineBreakpoints[url]) { - this._wholeLineBreakpoints[url] = []; + if (!this._wholeLineBreakpoints[actor]) { + this._wholeLineBreakpoints[actor] = []; } - if (!this._wholeLineBreakpoints[url][line]) { - this._wholeLineBreakpoints[url][line] = aBreakpoint; + + if (!this._wholeLineBreakpoints[actor][line]) { + this._wholeLineBreakpoints[actor][line] = aBreakpoint; this._size++; } - return this._wholeLineBreakpoints[url][line]; + return this._wholeLineBreakpoints[actor][line]; } }, @@ -141,16 +143,16 @@ BreakpointStore.prototype = { * @param Object aBreakpoint * The breakpoint to be removed. It is an object with the following * properties: - * - url + * - source * - line * - column (optional) */ - removeBreakpoint: function ({ url, line, column }) { + removeBreakpoint: function ({ source: { actor }, line, column }) { if (column != null) { - if (this._breakpoints[url]) { - if (this._breakpoints[url][line]) { - if (this._breakpoints[url][line][column]) { - delete this._breakpoints[url][line][column]; + if (this._breakpoints[actor]) { + if (this._breakpoints[actor][line]) { + if (this._breakpoints[actor][line][column]) { + delete this._breakpoints[actor][line][column]; this._size--; // If this was the last breakpoint on this line, delete the line from @@ -160,16 +162,16 @@ BreakpointStore.prototype = { // `this._breakpoints[url].length` directly, because deleting // properties from sparse arrays doesn't update the `length` property // like adding them does. - if (Object.keys(this._breakpoints[url][line]).length === 0) { - delete this._breakpoints[url][line]; + if (Object.keys(this._breakpoints[actor][line]).length === 0) { + delete this._breakpoints[actor][line]; } } } } } else { - if (this._wholeLineBreakpoints[url]) { - if (this._wholeLineBreakpoints[url][line]) { - delete this._wholeLineBreakpoints[url][line]; + if (this._wholeLineBreakpoints[actor]) { + if (this._wholeLineBreakpoints[actor][line]) { + delete this._wholeLineBreakpoints[actor][line]; this._size--; } } @@ -204,18 +206,18 @@ BreakpointStore.prototype = { * @param Object aLocation * The location of the breakpoint you are retrieving. It is an object * with the following properties: - * - url + * - source * - line * - column (optional) */ getBreakpoint: function (aLocation) { - let { url, line, column } = aLocation; - dbg_assert(url != null); + let { source: { actor, url }, line, column } = aLocation; + dbg_assert(actor != null); dbg_assert(line != null); var foundBreakpoint = this.hasBreakpoint(aLocation); if (foundBreakpoint == null) { - throw new Error("No breakpoint at url = " + url + throw new Error("No breakpoint at = " + (url || actor) + ", line = " + line + ", column = " + column); } @@ -229,14 +231,14 @@ BreakpointStore.prototype = { * @param Object aLocation * The location of the breakpoint you are retrieving. It is an object * with the following properties: - * - url + * - source * - line * - column (optional) * @returns The stored breakpoint if it exists, null otherwise. */ hasBreakpoint: function (aLocation) { - let { url, line, column } = aLocation; - dbg_assert(url != null); + let { source: { actor }, line, column } = aLocation; + dbg_assert(actor != null); dbg_assert(line != null); for (let bp of this.findBreakpoints(aLocation)) { // We will get whole line breakpoints before individual columns, so just @@ -256,7 +258,7 @@ BreakpointStore.prototype = { * * @param Object aSearchParams * Optional. An object with the following properties: - * - url + * - source * - line (optional; requires the url property) * - column (optional; requires the line property) */ @@ -265,56 +267,58 @@ BreakpointStore.prototype = { dbg_assert(aSearchParams.line != null); } if (aSearchParams.line != null) { - dbg_assert(aSearchParams.url != null); + dbg_assert(aSearchParams.source != null); + dbg_assert(aSearchParams.source.actor != null); } - for (let url of this._iterUrls(aSearchParams.url)) { - for (let line of this._iterLines(url, aSearchParams.line)) { + let actor = aSearchParams.source ? aSearchParams.source.actor : null; + for (let actor of this._iterActors(actor)) { + for (let line of this._iterLines(actor, aSearchParams.line)) { // Always yield whole line breakpoints first. See comment in // |BreakpointStore.prototype.hasBreakpoint|. if (aSearchParams.column == null - && this._wholeLineBreakpoints[url] - && this._wholeLineBreakpoints[url][line]) { - yield this._wholeLineBreakpoints[url][line]; + && this._wholeLineBreakpoints[actor] + && this._wholeLineBreakpoints[actor][line]) { + yield this._wholeLineBreakpoints[actor][line]; } - for (let column of this._iterColumns(url, line, aSearchParams.column)) { - yield this._breakpoints[url][line][column]; + for (let column of this._iterColumns(actor, line, aSearchParams.column)) { + yield this._breakpoints[actor][line][column]; } } } }, - _iterUrls: function* (aUrl) { - if (aUrl) { - if (this._breakpoints[aUrl] || this._wholeLineBreakpoints[aUrl]) { - yield aUrl; + _iterActors: function* (aActor) { + if (aActor) { + if (this._breakpoints[aActor] || this._wholeLineBreakpoints[aActor]) { + yield aActor; } } else { - for (let url of Object.keys(this._wholeLineBreakpoints)) { - yield url; + for (let actor of Object.keys(this._wholeLineBreakpoints)) { + yield actor; } - for (let url of Object.keys(this._breakpoints)) { - if (url in this._wholeLineBreakpoints) { + for (let actor of Object.keys(this._breakpoints)) { + if (actor in this._wholeLineBreakpoints) { continue; } - yield url; + yield actor; } } }, - _iterLines: function* (aUrl, aLine) { + _iterLines: function* (aActor, aLine) { if (aLine != null) { - if ((this._wholeLineBreakpoints[aUrl] - && this._wholeLineBreakpoints[aUrl][aLine]) - || (this._breakpoints[aUrl] && this._breakpoints[aUrl][aLine])) { + if ((this._wholeLineBreakpoints[aActor] + && this._wholeLineBreakpoints[aActor][aLine]) + || (this._breakpoints[aActor] && this._breakpoints[aActor][aLine])) { yield aLine; } } else { - const wholeLines = this._wholeLineBreakpoints[aUrl] - ? Object.keys(this._wholeLineBreakpoints[aUrl]) + const wholeLines = this._wholeLineBreakpoints[aActor] + ? Object.keys(this._wholeLineBreakpoints[aActor]) : []; - const columnLines = this._breakpoints[aUrl] - ? Object.keys(this._breakpoints[aUrl]) + const columnLines = this._breakpoints[aActor] + ? Object.keys(this._breakpoints[aActor]) : []; const lines = wholeLines.concat(columnLines).sort(); @@ -330,17 +334,17 @@ BreakpointStore.prototype = { } }, - _iterColumns: function* (aUrl, aLine, aColumn) { - if (!this._breakpoints[aUrl] || !this._breakpoints[aUrl][aLine]) { + _iterColumns: function* (aActor, aLine, aColumn) { + if (!this._breakpoints[aActor] || !this._breakpoints[aActor][aLine]) { return; } if (aColumn != null) { - if (this._breakpoints[aUrl][aLine][aColumn]) { + if (this._breakpoints[aActor][aLine][aColumn]) { yield aColumn; } } else { - for (let column in this._breakpoints[aUrl][aLine]) { + for (let column in this._breakpoints[aActor][aLine]) { yield column; } } @@ -349,6 +353,55 @@ BreakpointStore.prototype = { exports.BreakpointStore = BreakpointStore; +/** + * Keeps track of persistent sources across reloads and ties different + * source instances to the same actor id so that things like + * breakpoints survive reloads. ThreadSources uses this to force the + * same actorID on a SourceActor. + */ +function SourceActorStore() { + // source identifier --> actor id + this._sourceActorIds = Object.create(null); +} + +SourceActorStore.prototype = { + /** + * Lookup an existing actor id that represents this source, if available. + */ + getReusableActorId: function(aSource, aOriginalUrl) { + let url = this.getUniqueKey(aSource, aOriginalUrl); + if (url && url in this._sourceActorIds) { + return this._sourceActorIds[url]; + } + return null; + }, + + /** + * Update a source with an actorID. + */ + setReusableActorId: function(aSource, aOriginalUrl, actorID) { + let url = this.getUniqueKey(aSource, aOriginalUrl); + if (url) { + this._sourceActorIds[url] = actorID; + } + }, + + /** + * Make a unique URL from a source that identifies it across reloads. + */ + getUniqueKey: function(aSource, aOriginalUrl) { + if (aOriginalUrl) { + // Original source from a sourcemap. + return aOriginalUrl; + } + else { + return getSourceURL(aSource); + } + } +}; + +exports.SourceActorStore = SourceActorStore; + /** * Manages pushing event loops and automatically pops and exits them in the * correct order as they are resolved. @@ -533,6 +586,7 @@ function ThreadActor(aParent, aGlobal) }; this.breakpointStore = new BreakpointStore(); + this.sourceActorStore = new SourceActorStore(); this.blackBoxedSources = new Set(["self-hosted"]); this.prettyPrintedSources = new Map(); @@ -684,6 +738,11 @@ ThreadActor.prototype = { this.onResume(); } + // Blow away our source actor ID store because those IDs are only + // valid for this connection. This is ok because we never keep + // things like breakpoints across connections. + this._sourceActorStore = null; + this.clearDebuggees(); this.conn.removeActorPool(this._threadLifetimePool); this._threadLifetimePool = null; @@ -806,8 +865,27 @@ ThreadActor.prototype = { } packet.why = aReason; - this.sources.getOriginalLocation(packet.frame.where).then(aOrigPosition => { - packet.frame.where = aOrigPosition; + let loc = getFrameLocation(aFrame); + this.sources.getOriginalLocation(loc).then(aOrigPosition => { + if (!aOrigPosition.sourceActor) { + // The only time the source actor will be null is if there + // was a sourcemap and it tried to look up the original + // location but there was no original URL. This is a strange + // scenario so we simply don't pause. + DevToolsUtils.reportException( + 'ThreadActor', + new Error('Attempted to pause in a script with a sourcemap but ' + + 'could not find original location.') + ); + + return undefined; + } + + packet.frame.where = { + source: aOrigPosition.sourceActor.form(), + line: aOrigPosition.line, + column: aOrigPosition.column + }; resolve(onPacket(packet)) .then(null, error => { reportError(error); @@ -851,8 +929,9 @@ ThreadActor.prototype = { _makeOnEnterFrame: function ({ pauseAndRespond }) { return aFrame => { const generatedLocation = getFrameLocation(aFrame); - let { url } = this.synchronize(this.sources.getOriginalLocation( + let { sourceActor } = this.synchronize(this.sources.getOriginalLocation( generatedLocation)); + let url = sourceActor.url; return this.sources.isBlackBoxed(url) ? undefined @@ -865,8 +944,9 @@ ThreadActor.prototype = { // onPop is called with 'this' set to the current frame. const generatedLocation = getFrameLocation(this); - const { url } = thread.synchronize(thread.sources.getOriginalLocation( + const { sourceActor } = thread.synchronize(thread.sources.getOriginalLocation( generatedLocation)); + const url = sourceActor.url; if (thread.sources.isBlackBoxed(url)) { return undefined; @@ -1237,16 +1317,21 @@ ThreadActor.prototype = { */ _breakOnEnter: function(script) { let offsets = script.getAllOffsets(); + let sourceActor = this.sources.source({ source: script.source }); + for (let line = 0, n = offsets.length; line < n; line++) { if (offsets[line]) { - let location = { url: script.url, line: line }; - let resp = this._createAndStoreBreakpoint(location); + let location = { line: line }; + let resp = sourceActor._createAndStoreBreakpoint(location); dbg_assert(!resp.actualLocation, "No actualLocation should be returned"); if (resp.error) { reportError(new Error("Unable to set breakpoint on event listener")); return; } - let bp = this.breakpointStore.getBreakpoint(location); + let bp = this.breakpointStore.getBreakpoint({ + source: sourceActor.form(), + line: location.line + }); let bpActor = bp.actor; dbg_assert(bp, "Breakpoint must exist"); dbg_assert(bpActor, "Breakpoint actor must be created"); @@ -1329,14 +1414,19 @@ ThreadActor.prototype = { form.depth = i; frames.push(form); - let promise = this.sources.getOriginalLocation(form.where) - .then((aOrigLocation) => { - form.where = aOrigLocation; - let source = this.sources.source({ url: form.where.url }); - if (source) { - form.source = source.form(); - } - }); + let promise = this.sources.getOriginalLocation({ + source: frame.script.source, + line: form.where.line, + column: form.where.column + }).then((aOrigLocation) => { + let sourceForm = aOrigLocation.sourceActor.form(); + form.where = { + source: sourceForm, + line: aOrigLocation.line, + column: aOrigLocation.column + }; + form.source = sourceForm; + }); promises.push(promise); } @@ -1366,395 +1456,6 @@ ThreadActor.prototype = { return res ? res : {}; }, - /** - * Handle a protocol request to set a breakpoint. - */ - onSetBreakpoint: function (aRequest) { - if (this.state !== "paused") { - return { error: "wrongState", - message: "Breakpoints can only be set while the debuggee is paused."}; - } - - let { url: originalSource, - line: originalLine, - column: originalColumn } = aRequest.location; - - let locationPromise = this.sources.getGeneratedLocation(aRequest.location); - return locationPromise.then(({url, line, column}) => { - if (line == null || line < 0) { - return { - error: "noScript", - message: "Requested setting a breakpoint on " - + url + ":" + line - + (column != null ? ":" + column : "") - + " but there is no Debugger.Script at that location" - }; - } - - let response = this._createAndStoreBreakpoint({ - url: url, - line: line, - column: column, - condition: aRequest.condition - }); - // If the original location of our generated location is different from - // the original location we attempted to set the breakpoint on, we will - // need to know so that we can set actualLocation on the response. - let originalLocation = this.sources.getOriginalLocation({ - url: url, - line: line, - column: column - }); - - return all([response, originalLocation]) - .then(([aResponse, {url, line}]) => { - if (aResponse.actualLocation) { - let actualOrigLocation = this.sources.getOriginalLocation(aResponse.actualLocation); - return actualOrigLocation.then(({ url, line, column }) => { - if (url !== originalSource - || line !== originalLine - || column !== originalColumn) { - aResponse.actualLocation = { - url: url, - line: line, - column: column - }; - } - return aResponse; - }); - } - - if (url !== originalSource || line !== originalLine) { - aResponse.actualLocation = { url: url, line: line }; - } - - return aResponse; - }); - }); - }, - - /** - * Create a breakpoint at the specified location and store it in the - * cache. Takes ownership of `aLocation`. - * - * @param Object aLocation - * An object of the form { url, line[, column] } - */ - _createAndStoreBreakpoint: function (aLocation) { - // Add the breakpoint to the store for later reuse, in case it belongs to a - // script that hasn't appeared yet. - this.breakpointStore.addBreakpoint(aLocation); - return this._setBreakpoint(aLocation); - }, - - - /** - * Get or create the BreakpointActor for the breakpoint at the given location. - * - * NB: This will override a pre-existing BreakpointActor's condition with - * the given the location's condition. - * - * @param Object location - * The breakpoint location. See BreakpointStore.prototype.addBreakpoint - * for more information. - * @returns BreakpointActor - */ - _getOrCreateBreakpointActor: function (location) { - let actor; - const storedBp = this.breakpointStore.getBreakpoint(location); - - if (storedBp.actor) { - actor = storedBp.actor; - actor.condition = location.condition; - return actor; - } - - storedBp.actor = actor = new BreakpointActor(this, { - url: location.url, - line: location.line, - column: location.column, - condition: location.condition - }); - this.threadLifetimePool.addActor(actor); - return actor; - }, - - /** - * Set breakpoints at the offsets closest to our target location's column. - * - * @param Array scripts - * The set of Debugger.Script instances to consider. - * @param Object location - * The target location. - * @param BreakpointActor actor - * The BreakpointActor to handle hitting the breakpoints we set. - * @returns Object - * The RDP response. - */ - _setBreakpointAtColumn: function (scripts, location, actor) { - // Debugger.Script -> array of offset mappings - const scriptsAndOffsetMappings = new Map(); - - for (let script of scripts) { - this._findClosestOffsetMappings(location, script, scriptsAndOffsetMappings); - } - - for (let [script, mappings] of scriptsAndOffsetMappings) { - for (let offsetMapping of mappings) { - script.setBreakpoint(offsetMapping.offset, actor); - } - actor.addScript(script, this); - } - - return { - actor: actor.actorID - }; - }, - - /** - * Find the scripts which contain offsets that are an entry point to the given - * line. - * - * @param Array scripts - * The set of Debugger.Scripts to consider. - * @param Number line - * The line we are searching for entry points into. - * @returns Array of objects of the form { script, offsets } where: - * - script is a Debugger.Script - * - offsets is an array of offsets that are entry points into the - * given line. - */ - _findEntryPointsForLine: function (scripts, line) { - const entryPoints = []; - for (let script of scripts) { - const offsets = script.getLineOffsets(line); - if (offsets.length) { - entryPoints.push({ script, offsets }); - } - } - return entryPoints; - }, - - /** - * Find the first line that is associated with bytecode offsets, and is - * greater than or equal to the given start line. - * - * @param Array scripts - * The set of Debugger.Script instances to consider. - * @param Number startLine - * The target line. - * @return Object|null - * If we can't find a line matching our constraints, return - * null. Otherwise, return an object of the form: - * { - * line: Number, - * entryPoints: [ - * { script: Debugger.Script, offsets: [offset, ...] }, - * ... - * ] - * } - */ - _findNextLineWithOffsets: function (scripts, startLine) { - const maxLine = Math.max(...scripts.map(s => s.startLine + s.lineCount)); - - for (let line = startLine; line < maxLine; line++) { - const entryPoints = this._findEntryPointsForLine(scripts, line); - if (entryPoints.length) { - return { line, entryPoints }; - } - } - - return null; - }, - - /** - * Set a breakpoint using the Debugger API. If the line on which the - * breakpoint is being set contains no code, then the breakpoint will slide - * down to the next line that has runnable code. In this case the server - * breakpoint cache will be updated, so callers that iterate over the - * breakpoint cache should take that into account. - * - * @param object aLocation - * The location of the breakpoint (in the generated source, if source - * mapping). - * @param Debugger.Script aOnlyThisScript [optional] - * If provided, only set breakpoints in this Debugger.Script, and - * nowhere else. - */ - _setBreakpoint: function (aLocation, aOnlyThisScript=null) { - const location = { - url: aLocation.url, - line: aLocation.line, - column: aLocation.column, - condition: aLocation.condition - }; - const actor = location.actor = this._getOrCreateBreakpointActor(location); - const scripts = this.dbg.findScripts({ - url: location.url, - // Although we will automatically slide the breakpoint down to the first - // line with code when the requested line doesn't have any, we want to - // restrict the sliding to within functions that contain the requested - // line. - line: location.line - }); - - if (scripts.length === 0) { - // Since we did not find any scripts to set the breakpoint on now, return - // early. When a new script that matches this breakpoint location is - // introduced, the breakpoint actor will already be in the breakpoint - // store and the breakpoint will be set at that time. This is similar to - // GDB's "pending" breakpoints for shared libraries that aren't loaded - // yet. - return { - actor: actor.actorID - }; - } - - if (location.column) { - return this._setBreakpointAtColumn(scripts, location, actor); - } - - // Select the first line that has offsets, and is greater than or equal to - // the requested line. Set breakpoints on each of the offsets that is an - // entry point to our selected line. - - const result = this._findNextLineWithOffsets(scripts, location.line); - if (!result) { - return { - error: "noCodeAtLineColumn", - actor: actor.actorID - }; - } - - const { line, entryPoints } = result; - const actualLocation = line !== location.line - ? { url: location.url, line } - : undefined; - - if (actualLocation) { - // Check whether we already have a breakpoint actor for the actual - // location. If we do have an existing actor, then the actor we created - // above is redundant and must be destroyed. If we do not have an existing - // actor, we need to update the breakpoint store with the new location. - - const existingBreakpoint = this.breakpointStore.hasBreakpoint(actualLocation); - if (existingBreakpoint && existingBreakpoint.actor) { - actor.onDelete(); - this.breakpointStore.removeBreakpoint(location); - return { - actor: existingBreakpoint.actor.actorID, - actualLocation - }; - } else { - actor.location = actualLocation; - this.breakpointStore.moveBreakpoint(location, actualLocation); - } - } - - this._setBreakpointOnEntryPoints( - actor, - aOnlyThisScript - ? entryPoints.filter(o => o.script === aOnlyThisScript) - : entryPoints - ); - - return { - actor: actor.actorID, - actualLocation - }; - }, - - /** - * Set breakpoints on all the given entry points with the given - * BreakpointActor as the handler. - * - * @param BreakpointActor actor - * The actor handling the breakpoint hits. - * @param Array entryPoints - * An array of objects of the form `{ script, offsets }`. - */ - _setBreakpointOnEntryPoints: function (actor, entryPoints) { - for (let { script, offsets } of entryPoints) { - for (let offset of offsets) { - script.setBreakpoint(offset, actor); - } - actor.addScript(script, this); - } - }, - - /** - * Find all of the offset mappings associated with `aScript` that are closest - * to `aTargetLocation`. If new offset mappings are found that are closer to - * `aTargetOffset` than the existing offset mappings inside - * `aScriptsAndOffsetMappings`, we empty that map and only consider the - * closest offset mappings. - * - * In many cases, but not all, this method finds only one closest offset. - * Consider the following case, where multiple offsets will be found: - * - * 0 1 2 3 - * 0123456789012345678901234567890 - * +------------------------------- - * 1|function f() { - * 2| return g() + h(); - * 3|} - * - * The Debugger reports three offsets on line 2 upon which we could set a - * breakpoint: the `return` statement at column 2, the call expression `g()` - * at column 9, and the call expression `h()` at column 15. (Careful readers - * will note that complete source location information isn't saved by - * SpiderMonkey's frontend, and we don't get an offset associated specifically - * with the `+` operation.) - * - * If our target location is line 2 column 12, the offset for the call to `g` - * is 3 columns to the left and the offset for the call to `h` is 3 columns to - * the right. Because they are equally close, we will return both offsets to - * have breakpoints set upon them. - * - * @param Object aTargetLocation - * An object of the form { url, line[, column] }. - * @param Debugger.Script aScript - * The script in which we are searching for offsets. - * @param Map aScriptsAndOffsetMappings - * A Map object which maps Debugger.Script instances to arrays of - * offset mappings. This is an out param. - */ - _findClosestOffsetMappings: function (aTargetLocation, - aScript, - aScriptsAndOffsetMappings) { - let offsetMappings = aScript.getAllColumnOffsets() - .filter(({ lineNumber }) => lineNumber === aTargetLocation.line); - - // Attempt to find the current closest offset distance from the target - // location by grabbing any offset mapping in the map by doing one iteration - // and then breaking (they all have the same distance from the target - // location). - let closestDistance = Infinity; - if (aScriptsAndOffsetMappings.size) { - for (let mappings of aScriptsAndOffsetMappings.values()) { - closestDistance = Math.abs(aTargetLocation.column - mappings[0].columnNumber); - break; - } - } - - for (let mapping of offsetMappings) { - let currentDistance = Math.abs(aTargetLocation.column - mapping.columnNumber); - - if (currentDistance > closestDistance) { - continue; - } else if (currentDistance < closestDistance) { - closestDistance = currentDistance; - aScriptsAndOffsetMappings.clear(); - aScriptsAndOffsetMappings.set(aScript, [mapping]); - } else { - if (!aScriptsAndOffsetMappings.has(aScript)) { - aScriptsAndOffsetMappings.set(aScript, []); - } - aScriptsAndOffsetMappings.get(aScript).push(mapping); - } - } - }, - /** * Get the script and source lists from the debugger. */ @@ -1794,6 +1495,7 @@ ThreadActor.prototype = { } }, + /** * Handle a protocol request to pause the debuggee. */ @@ -2315,8 +2017,9 @@ ThreadActor.prototype = { // Don't pause if we are currently stepping (in or over) or the frame is // black-boxed. const generatedLocation = getFrameLocation(aFrame); - const { url } = this.synchronize(this.sources.getOriginalLocation( + const { sourceActor } = this.synchronize(this.sources.getOriginalLocation( generatedLocation)); + const url = sourceActor ? sourceActor.url : null; return this.sources.isBlackBoxed(url) || aFrame.onStep ? undefined @@ -2346,8 +2049,9 @@ ThreadActor.prototype = { } const generatedLocation = getFrameLocation(aFrame); - const { url } = this.synchronize(this.sources.getOriginalLocation( + const { sourceActor } = this.synchronize(this.sources.getOriginalLocation( generatedLocation)); + const url = sourceActor ? sourceActor.url : null; if (this.sources.isBlackBoxed(url)) { return undefined; @@ -2381,6 +2085,7 @@ ThreadActor.prototype = { * A Debugger.Object instance whose referent is the global object. */ onNewScript: function (aScript, aGlobal) { + this.sources.sourcesForScript(aScript); this._addScript(aScript); // |onNewScript| is only fired for top level scripts (AKA staticLevel == 0), @@ -2389,8 +2094,6 @@ ThreadActor.prototype = { for (let s of aScript.getChildScripts()) { this._addScript(s); } - - this.sources.sourcesForScript(aScript); }, onNewSource: function (aSource) { @@ -2409,16 +2112,19 @@ ThreadActor.prototype = { * The url of the script's source that will be stored. * @returns true, if the script can be added, false otherwise. */ - _allowSource: function (aSourceUrl) { - // Ignore anything we don't have a URL for (eval scripts, for example). - if (!aSourceUrl) + _allowSource: function (aSource) { + let url = getSourceURL(aSource); + + if (isHiddenSource(aSource)) { return false; + } + // Ignore XBL bindings for content debugging. - if (aSourceUrl.indexOf("chrome://") == 0) { + if (url && url.indexOf("chrome://") == 0) { return false; } // Ignore about:* pages for content debugging. - if (aSourceUrl.indexOf("about:") == 0) { + if (url && url.indexOf("about:") == 0) { return false; } return true; @@ -2445,18 +2151,19 @@ ThreadActor.prototype = { * @returns true, if the script was added; false otherwise. */ _addScript: function (aScript) { - if (!this._allowSource(aScript.url)) { + if (!this._allowSource(aScript.source)) { return false; } // Set any stored breakpoints. let endLine = aScript.startLine + aScript.lineCount - 1; - for (let bp of this.breakpointStore.findBreakpoints({ url: aScript.url })) { + let source = this.sources.source({ source: aScript.source }); + for (let bp of this.breakpointStore.findBreakpoints(source.form())) { // Limit the search to the line numbers contained in the new script. if (bp.line >= aScript.startLine && bp.line <= endLine) { - this._setBreakpoint(bp, aScript); + source._setBreakpoint(bp, aScript); } } @@ -2490,7 +2197,6 @@ ThreadActor.prototype = { return { from: this.actorID, actors: result }; } - }; ThreadActor.prototype.requestTypes = { @@ -2503,7 +2209,6 @@ ThreadActor.prototype.requestTypes = { "interrupt": ThreadActor.prototype.onInterrupt, "eventListeners": ThreadActor.prototype.onEventListeners, "releaseMany": ThreadActor.prototype.onReleaseMany, - "setBreakpoint": ThreadActor.prototype.onSetBreakpoint, "sources": ThreadActor.prototype.onSources, "threadGrips": ThreadActor.prototype.onThreadGrips, "prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties @@ -2616,34 +2321,53 @@ function resolveURIToLocalPath(aURI) { } /** - * A SourceActor provides information about the source of a script. + * A SourceActor provides information about the source of a script. There + * are two kinds of source actors: ones that represent real source objects, + * and ones that represent non-existant "original" sources when the real + * sources are sourcemapped. When a source is sourcemapped, actors are + * created for both the "generated" and "original" sources, and the client will + * only see the original sources. We separate these because there isn't + * a 1:1 mapping of generated to original sources; one generated source + * may represent N original sources, so we need to create N + 1 separate + * actors. * - * @param String url - * The url of the source we are representing. + * There are 4 different scenarios for sources that you should + * understand: + * + * - A single non-sourcemapped source that is not inlined in HTML + * (separate JS file, eval'ed code, etc) + * - A single sourcemapped source which creates N original sources + * - An HTML page with multiple inline scripts, which are distinct + * sources, but should be represented as a single source + * - A pretty-printed source (which may or may not be an original + * sourcemapped source), which generates a sourcemap for itself + * + * The complexity of `SourceActor` and `ThreadSources` are to handle + * all of thise cases and hopefully internalize the complexities. + * + * @param Debugger.Source source + * The source object we are representing. * @param ThreadActor thread * The current thread actor. - * @param SourceMapConsumer sourceMap - * Optional. The source map that introduced this source, if available. - * @param String generatedSource + * @param String originalUrl + * Optional. For sourcemapped urls, the original url this is representing. + * @param Debugger.Source generatedSource * Optional, passed in when aSourceMap is also passed in. The generated - * source url that introduced this source. - * @param String text - * Optional. The content text of this source, if immediately available. + * source object that introduced this source. * @param String contentType * Optional. The content type of this source, if immediately available. */ -function SourceActor({ url, thread, sourceMap, generatedSource, text, +function SourceActor({ source, thread, originalUrl, generatedSource, contentType }) { this._threadActor = thread; - this._url = url; - this._sourceMap = sourceMap; + this._originalUrl = originalUrl; + this._source = source; this._generatedSource = generatedSource; - this._text = text; this._contentType = contentType; this.onSource = this.onSource.bind(this); this._invertSourceMap = this._invertSourceMap.bind(this); - this._saveMap = this._saveMap.bind(this); + this._encodeAndSetSourceMapURL = this._encodeAndSetSourceMapURL.bind(this); this._getSourceText = this._getSourceText.bind(this); this._mapSourceToAddon(); @@ -2668,24 +2392,43 @@ SourceActor.prototype = { _addonID: null, _addonPath: null, - get threadActor() this._threadActor, - get url() this._url, - get addonID() this._addonID, - get addonPath() this._addonPath, + get threadActor() { return this._threadActor; }, + get dbg() { return this.threadActor.dbg; }, + get source() { return this._source; }, + get generatedSource() { return this._generatedSource; }, + get breakpointStore() { return this.threadActor.breakpointStore; }, + get url() { + if (this.source) { + return getSourceURL(this.source); + } + return this._originalUrl; + }, + get addonID() { return this._addonID; }, + get addonPath() { return this._addonPath; }, get prettyPrintWorker() { return this.threadActor.prettyPrintWorker; }, form: function () { + let source = this.source || this.generatedSource; + // This might not have a source or a generatedSource because we + // treat HTML pages with inline scripts as a special SourceActor + // that doesn't have either + let introductionUrl = null; + if (source && source.introductionScript) { + introductionUrl = source.introductionScript.source.url; + } + return { actor: this.actorID, - url: this._url, + url: this.url, addonID: this._addonID, addonPath: this._addonPath, isBlackBoxed: this.threadActor.sources.isBlackBoxed(this.url), - isPrettyPrinted: this.threadActor.sources.isPrettyPrinted(this.url) - // TODO bug 637572: introductionScript + isPrettyPrinted: this.threadActor.sources.isPrettyPrinted(this.url), + introductionUrl: introductionUrl, + introductionType: source ? source.introductionType : null }; }, @@ -2697,7 +2440,7 @@ SourceActor.prototype = { _mapSourceToAddon: function() { try { - var nsuri = Services.io.newURI(this._url.split(" -> ").pop(), null, null); + var nsuri = Services.io.newURI(this.url.split(" -> ").pop(), null, null); } catch (e) { // We can't do anything with an invalid URI @@ -2731,7 +2474,7 @@ SourceActor.prototype = { } if (!file) { - const error = new Error("Could not find the root of the add-on for " + this._url); + const error = new Error("Could not find the root of the add-on for " + this.url); DevToolsUtils.reportException("SourceActor.prototype._mapSourceToAddon", error) return; } @@ -2742,31 +2485,44 @@ SourceActor.prototype = { }, _getSourceText: function () { - const toResolvedContent = t => resolve({ + let toResolvedContent = t => ({ content: t, contentType: this._contentType }); - let sc; - if (this._sourceMap && (sc = this._sourceMap.sourceContentFor(this._url))) { - return toResolvedContent(sc); - } + let genSource = this.generatedSource || this.source; + return this.threadActor.sources.fetchSourceMap(genSource).then(map => { + let sc; + if (map && (sc = map.sourceContentFor(this.url))) { + return toResolvedContent(sc); + } - if (this._text) { - return toResolvedContent(this._text); - } + // Use `source.text` if it exists, is not the "no source" + // string, and the content type of the source is JavaScript. It + // will be "no source" if the Debugger API wasn't able to load + // the source because sources were discarded + // (javascript.options.discardSystemSource == true). Re-fetch + // non-JS sources to get the contentType from the headers. + if (this.source && + this.source.text !== "[no source]" && + this._contentType && + this._contentType.indexOf('javascript') !== -1) { + return toResolvedContent(this.source.text); + } + else { + // XXX bug 865252: Don't load from the cache if this is a source mapped + // source because we can't guarantee that the cache has the most up to date + // content for this source like we can if it isn't source mapped. + let sourceFetched = fetch(this.url, { loadFromCache: !this.source }); - // XXX bug 865252: Don't load from the cache if this is a source mapped - // source because we can't guarantee that the cache has the most up to date - // content for this source like we can if it isn't source mapped. - let sourceFetched = fetch(this._url, { loadFromCache: !this._sourceMap }); + // Record the contentType we just learned during fetching + sourceFetched.then(({ contentType }) => { + this._contentType = contentType; + }); - // Record the contentType we just learned during fetching - sourceFetched.then(({ contentType }) => { - this._contentType = contentType; + return sourceFetched; + } }); - - return sourceFetched; }, /** @@ -2779,34 +2535,39 @@ SourceActor.prototype = { from: this.actorID }; - let lines; - - if (this._sourceMap) { - lines = new Set(); - - // Position of executable lines in the generated source - let offsets = this.getExecutableOffsets(this._generatedSource, false); - for (let offset of offsets) { - let {line, source} = this._sourceMap.originalPositionFor({ - line: offset.lineNumber, - column: offset.columnNumber - }); - - if (source === this._url) { - lines.add(line); - } - } - } else { - // Converting the set given by getExecutableOffsets to an array - lines = this.getExecutableOffsets(this._url, true); + function sortLines(lines) { + // Converting the Set into an array + lines = [line for (line of lines)]; + lines.sort((a, b) => { + return a - b; + }); + return lines; } - // Converting the Set into an array - packet.lines = [line for (line of lines)]; - packet.lines.sort((a, b) => { - return a - b; - }); + if (this.generatedSource) { + return this.threadActor.sources.getSourceMap(this.generatedSource).then(sm => { + let lines = new Set(); + // Position of executable lines in the generated source + let offsets = this.getExecutableOffsets(this.generatedSource, false); + for (let offset of offsets) { + let {line, source: sourceUrl} = sm.originalPositionFor({ + line: offset.lineNumber, + column: offset.columnNumber + }); + + if (sourceUrl === this.url) { + lines.add(line); + } + } + + packet.lines = sortLines(lines); + return packet; + }); + } + + let lines = this.getExecutableOffsets(this.source, true); + packet.lines = sortLines(lines); return packet; }, @@ -2816,13 +2577,11 @@ SourceActor.prototype = { * @param Boolean onlyLine - will return only the line number * @return Set - Executable offsets/lines of the script **/ - getExecutableOffsets: function (url, onlyLine) { + getExecutableOffsets: function (source, onlyLine) { let offsets = new Set(); - for (let s of this.threadActor.dbg.findScripts(this.threadActor.global)) { - if (s.url === url) { - for (let offset of s.getAllColumnOffsets()) { - offsets.add(onlyLine ? offset.lineNumber : offset); - } + for (let s of this.threadActor.dbg.findScripts({ source: source })) { + for (let offset of s.getAllColumnOffsets()) { + offsets.add(onlyLine ? offset.lineNumber : offset); } } @@ -2848,7 +2607,7 @@ SourceActor.prototype = { return { "from": this.actorID, "error": "loadSourceError", - "message": "Could not load the source for " + this._url + ".\n" + "message": "Could not load the source for " + this.url + ".\n" + DevToolsUtils.safeErrorString(aError) }; }); @@ -2858,11 +2617,11 @@ SourceActor.prototype = { * Handler for the "prettyPrint" packet. */ onPrettyPrint: function ({ indent }) { - this.threadActor.sources.prettyPrint(this._url, indent); + this.threadActor.sources.prettyPrint(this.url, indent); return this._getSourceText() .then(this._sendToPrettyPrintWorker(indent)) .then(this._invertSourceMap) - .then(this._saveMap) + .then(this._encodeAndSetSourceMapURL) .then(() => { // We need to reset `_init` now because we have already done the work of // pretty printing, and don't want onSource to wait forever for @@ -2913,7 +2672,7 @@ SourceActor.prototype = { this.prettyPrintWorker.addEventListener("message", onReply, false); this.prettyPrintWorker.postMessage({ id: id, - url: this._url, + url: this.url, indent: aIndent, source: content }); @@ -2931,7 +2690,7 @@ SourceActor.prototype = { * Note that the source map is modified in place. */ _invertSourceMap: function ({ code, mappings }) { - const generator = new SourceMapGenerator({ file: this._url }); + const generator = new SourceMapGenerator({ file: this.url }); return DevToolsUtils.yieldingEach(mappings, m => { let mapping = { generated: { @@ -2949,7 +2708,7 @@ SourceActor.prototype = { } generator.addMapping(mapping); }).then(() => { - generator.setSourceContent(this._url, code); + generator.setSourceContent(this.url, code); const consumer = SourceMapConsumer.fromSourceMap(generator); // XXX bug 918802: Monkey punch the source map consumer, because iterating @@ -2963,9 +2722,9 @@ SourceActor.prototype = { const location = getGenPos({ line: line, column: column, - source: this._url + source: this.url }); - location.source = this._url; + location.source = this.url; return location; }; @@ -2987,29 +2746,47 @@ SourceActor.prototype = { * pretty printing a source mapped source, we need to compose the existing * source map with our new one. */ - _saveMap: function ({ map }) { - if (this._sourceMap) { - // Compose the source maps - this._oldSourceMap = this._sourceMap; - this._sourceMap = SourceMapGenerator.fromSourceMap(this._sourceMap); - this._sourceMap.applySourceMap(map, this._url); - this._sourceMap = SourceMapConsumer.fromSourceMap(this._sourceMap); - this._threadActor.sources.saveSourceMap(this._sourceMap, - this._generatedSource); - } else { - this._sourceMap = map; - this._threadActor.sources.saveSourceMap(this._sourceMap, this._url); - } + _encodeAndSetSourceMapURL: function ({ map: sm }) { + let source = this.generatedSource || this.source; + let sources = this.threadActor.sources; + + return sources.getSourceMap(source).then(prevMap => { + if (prevMap) { + // Compose the source maps + this._oldSourceMapping = { + url: source.sourceMapURL, + map: prevMap + }; + + prevMap = SourceMapGenerator.fromSourceMap(prevMap); + prevMap.applySourceMap(sm, this.url); + sm = SourceMapConsumer.fromSourceMap(prevMap); + } + + let sources = this.threadActor.sources; + sources.clearSourceMapCache(source.sourceMapURL); + sources.setSourceMapHard(source, null, sm); + }); }, /** * Handler for the "disablePrettyPrint" packet. */ onDisablePrettyPrint: function () { - this._sourceMap = this._oldSourceMap; - this.threadActor.sources.saveSourceMap(this._sourceMap, - this._generatedSource || this._url); - this.threadActor.sources.disablePrettyPrint(this._url); + let source = this.generatedSource || this.source; + let sources = this.threadActor.sources; + let sm = sources.getSourceMap(source); + + sources.clearSourceMapCache(source.sourceMapURL, { hard: true }); + + if (this._oldSourceMapping) { + sources.setSourceMapHard(source, + this._oldSourceMapping.url, + this._oldSourceMapping.map); + this._oldSourceMapping = null; + } + + this.threadActor.sources.disablePrettyPrint(this.url); return this.onSource(); }, @@ -3037,6 +2814,429 @@ SourceActor.prototype = { return { from: this.actorID }; + }, + + /** + * Handle a protocol request to set a breakpoint. + */ + onSetBreakpoint: function(aRequest) { + if (this.threadActor.state !== "paused") { + return { error: "wrongState", + message: "Breakpoints can only be set while the debuggee is paused."}; + } + + let loc = { + url: this.url, + line: aRequest.location.line, + column: aRequest.location.column, + }; + let originalLoc = loc; + + return this.threadActor.sources.getGeneratedLocation({ + sourceActor: this, + line: loc.line, + column: loc.column + }).then(genLoc => { + if (genLoc.sourceActor !== this) { + return genLoc.sourceActor._createBreakpoint(genLoc, originalLoc, aRequest.condition); + } + else { + return this._createBreakpoint(genLoc, originalLoc, aRequest.condition); + } + }); + }, + + _createBreakpoint: function(loc, originalLoc, condition) { + return resolve(null).then(() => { + return this._createAndStoreBreakpoint({ + line: loc.line, + column: loc.column, + condition: condition + }); + }).then(response => { + var actual = response.actualLocation; + if (actual) { + if (this.source) { + return this.threadActor.sources.getOriginalLocation({ + source: this.source, + line: actual.line, + column: actual.column + }).then(({ sourceActor, line, column }) => { + if (sourceActor.url !== originalLoc.url || + line !== originalLoc.line || + column !== originalLoc.column) { + response.actualLocation = { + source: sourceActor.form(), + line: line, + column: column + }; + } + return response; + }); + } + else { + response.actualLocation = { + source: this.form(), + line: actual.line, + column: actual.column + } + return response; + } + } + else { + if (this.source) { + // Get the original location known by the sourcemap and see if + // it's different from our initial arguments + return this.threadActor.sources.getOriginalLocation({ + source: this.source, + line: loc.line, + column: loc.column + }).then(({ sourceActor, line }) => { + if (originalLoc.url !== sourceActor.url || + originalLoc.line !== line) { + response.actualLocation = { + source: sourceActor.form(), + line: line + }; + } + return response; + }); + } + else { + return response; + } + } + }).then(null, error => { + DevToolsUtils.reportException("onSetBreakpoint", error); + }); + }, + + /** + * Create a breakpoint at the specified location and store it in the + * cache. Takes ownership of `aRequest`. This is the + * generated location if this source is sourcemapped. + * + * @param Object aRequest + * An object of the form { line[, column, condition] }. The + * location is in the generated source, if sourcemapped. + */ + _createAndStoreBreakpoint: function (aRequest) { + let bp = update({}, aRequest, { source: this.form() }); + this.breakpointStore.addBreakpoint(bp); + return this._setBreakpoint(aRequest); + }, + + /** Get or create the BreakpointActor for the breakpoint at the given location. + * + * NB: This will override a pre-existing BreakpointActor's condition with + * the given the location's condition. + * + * @param Object location + * The breakpoint location. See BreakpointStore.prototype.addBreakpoint + * for more information. + * @returns BreakpointActor + */ + _getOrCreateBreakpointActor: function (location) { + let actor; + const storedBp = this.breakpointStore.getBreakpoint(location); + + if (storedBp.actor) { + actor = storedBp.actor; + actor.condition = location.condition; + return actor; + } + + storedBp.actor = actor = new BreakpointActor(this.threadActor, { + sourceActor: this, + line: location.line, + column: location.column, + condition: location.condition + }); + this.threadActor.threadLifetimePool.addActor(actor); + return actor; + }, + + /** + * Set breakpoints at the offsets closest to our target location's column. + * + * @param Array scripts + * The set of Debugger.Script instances to consider. + * @param Object location + * The target location. + * @param BreakpointActor actor + * The BreakpointActor to handle hitting the breakpoints we set. + * @returns Object + * The RDP response. + */ + _setBreakpointAtColumn: function (scripts, location, actor) { + // Debugger.Script -> array of offset mappings + const scriptsAndOffsetMappings = new Map(); + + for (let script of scripts) { + this._findClosestOffsetMappings(location, script, scriptsAndOffsetMappings); + } + + for (let [script, mappings] of scriptsAndOffsetMappings) { + for (let offsetMapping of mappings) { + script.setBreakpoint(offsetMapping.offset, actor); + } + actor.addScript(script, this.threadActor); + } + + return { + actor: actor.actorID + }; + }, + + /** + * Find the scripts which contain offsets that are an entry point to the given + * line. + * + * @param Array scripts + * The set of Debugger.Scripts to consider. + * @param Number line + * The line we are searching for entry points into. + * @returns Array of objects of the form { script, offsets } where: + * - script is a Debugger.Script + * - offsets is an array of offsets that are entry points into the + * given line. + */ + _findEntryPointsForLine: function (scripts, line) { + const entryPoints = []; + for (let script of scripts) { + const offsets = script.getLineOffsets(line); + if (offsets.length) { + entryPoints.push({ script, offsets }); + } + } + return entryPoints; + }, + + /** + * Find the first line that is associated with bytecode offsets, and is + * greater than or equal to the given start line. + * + * @param Array scripts + * The set of Debugger.Script instances to consider. + * @param Number startLine + * The target line. + * @return Object|null + * If we can't find a line matching our constraints, return + * null. Otherwise, return an object of the form: + * { + * line: Number, + * entryPoints: [ + * { script: Debugger.Script, offsets: [offset, ...] }, + * ... + * ] + * } + */ + _findNextLineWithOffsets: function (scripts, startLine) { + const maxLine = Math.max(...scripts.map(s => s.startLine + s.lineCount)); + + for (let line = startLine; line < maxLine; line++) { + const entryPoints = this._findEntryPointsForLine(scripts, line); + if (entryPoints.length) { + return { line, entryPoints }; + } + } + + return null; + }, + + /** + * Set a breakpoint using the Debugger API. If the line on which the + * breakpoint is being set contains no code, then the breakpoint will slide + * down to the next line that has runnable code. In this case the server + * breakpoint cache will be updated, so callers that iterate over the + * breakpoint cache should take that into account. + * + * @param object aLocation + * The location of the breakpoint (in the generated source, if source + * mapping). + * @param Debugger.Script aOnlyThisScript [optional] + * If provided, only set breakpoints in this Debugger.Script, and + * nowhere else. + */ + _setBreakpoint: function (aLocation, aOnlyThisScript=null) { + const location = { + source: this.form(), + line: aLocation.line, + column: aLocation.column, + condition: aLocation.condition + }; + const actor = location.actor = this._getOrCreateBreakpointActor(location); + + // Find all scripts matching the given location. We will almost + // always have a `source` object to query, but inline HTML scripts + // are all represented by 1 SourceActor even though they have + // separate source objects, so we need to query based on the url + // of the page for them. + const scripts = this.dbg.findScripts({ + source: this.source || undefined, + url: this._originalUrl || undefined, + line: location.line, + }); + + if (scripts.length === 0) { + // Since we did not find any scripts to set the breakpoint on now, return + // early. When a new script that matches this breakpoint location is + // introduced, the breakpoint actor will already be in the breakpoint + // store and the breakpoint will be set at that time. This is similar to + // GDB's "pending" breakpoints for shared libraries that aren't loaded + // yet. + return { + actor: actor.actorID + } + } + + if (location.column) { + return this._setBreakpointAtColumn(scripts, location, actor); + } + + // Select the first line that has offsets, and is greater than or equal to + // the requested line. Set breakpoints on each of the offsets that is an + // entry point to our selected line. + + const result = this._findNextLineWithOffsets(scripts, location.line); + if (!result) { + return { + error: "noCodeAtLineColumn", + actor: actor.actorID + }; + } + + const { line, entryPoints } = result; + const actualLocation = line !== location.line + ? { source: { actor: this.actorID }, line } + : undefined; + + if (actualLocation) { + // Check whether we already have a breakpoint actor for the actual + // location. If we do have an existing actor, then the actor we created + // above is redundant and must be destroyed. If we do not have an existing + // actor, we need to update the breakpoint store with the new location. + + const existingBreakpoint = this.breakpointStore.hasBreakpoint(actualLocation); + if (existingBreakpoint && existingBreakpoint.actor) { + actor.onDelete(); + this.breakpointStore.removeBreakpoint(location); + return { + actor: existingBreakpoint.actor.actorID, + actualLocation + }; + } else { + actor.location = actualLocation; + actor.location = { + sourceActor: this, + line: actualLocation.line + }; + this.breakpointStore.moveBreakpoint(location, actualLocation); + } + } + + this._setBreakpointOnEntryPoints( + actor, + aOnlyThisScript + ? entryPoints.filter(o => o.script === aOnlyThisScript) + : entryPoints + ); + + return { + actor: actor.actorID, + actualLocation + }; + }, + + /** + * Set breakpoints on all the given entry points with the given + * BreakpointActor as the handler. + * + * @param BreakpointActor actor + * The actor handling the breakpoint hits. + * @param Array entryPoints + * An array of objects of the form `{ script, offsets }`. + */ + _setBreakpointOnEntryPoints: function (actor, entryPoints) { + for (let { script, offsets } of entryPoints) { + for (let offset of offsets) { + script.setBreakpoint(offset, actor); + } + actor.addScript(script, this.threadActor); + } + }, + + /** + * Find all of the offset mappings associated with `aScript` that are closest + * to `aTargetLocation`. If new offset mappings are found that are closer to + * `aTargetOffset` than the existing offset mappings inside + * `aScriptsAndOffsetMappings`, we empty that map and only consider the + * closest offset mappings. + * + * In many cases, but not all, this method finds only one closest offset. + * Consider the following case, where multiple offsets will be found: + * + * 0 1 2 3 + * 0123456789012345678901234567890 + * +------------------------------- + * 1|function f() { + * 2| return g() + h(); + * 3|} + * + * The Debugger reports three offsets on line 2 upon which we could set a + * breakpoint: the `return` statement at column 2, the call expression `g()` + * at column 9, and the call expression `h()` at column 15. (Careful readers + * will note that complete source location information isn't saved by + * SpiderMonkey's frontend, and we don't get an offset associated specifically + * with the `+` operation.) + * + * If our target location is line 2 column 12, the offset for the call to `g` + * is 3 columns to the left and the offset for the call to `h` is 3 columns to + * the right. Because they are equally close, we will return both offsets to + * have breakpoints set upon them. + * + * @param Object aTargetLocation + * An object of the form { url, line[, column] }. + * @param Debugger.Script aScript + * The script in which we are searching for offsets. + * @param Map aScriptsAndOffsetMappings + * A Map object which maps Debugger.Script instances to arrays of + * offset mappings. This is an out param. + */ + _findClosestOffsetMappings: function (aTargetLocation, + aScript, + aScriptsAndOffsetMappings) { + let offsetMappings = aScript.getAllColumnOffsets() + .filter(({ lineNumber }) => lineNumber === aTargetLocation.line); + + // Attempt to find the current closest offset distance from the target + // location by grabbing any offset mapping in the map by doing one iteration + // and then breaking (they all have the same distance from the target + // location). + let closestDistance = Infinity; + if (aScriptsAndOffsetMappings.size) { + for (let mappings of aScriptsAndOffsetMappings.values()) { + closestDistance = Math.abs(aTargetLocation.column - mappings[0].columnNumber); + break; + } + } + + for (let mapping of offsetMappings) { + let currentDistance = Math.abs(aTargetLocation.column - mapping.columnNumber); + + if (currentDistance > closestDistance) { + continue; + } else if (currentDistance < closestDistance) { + closestDistance = currentDistance; + aScriptsAndOffsetMappings.clear(); + aScriptsAndOffsetMappings.set(aScript, [mapping]); + } else { + if (!aScriptsAndOffsetMappings.has(aScript)) { + aScriptsAndOffsetMappings.set(aScript, []); + } + aScriptsAndOffsetMappings.get(aScript).push(mapping); + } + } } }; @@ -3046,7 +3246,8 @@ SourceActor.prototype.requestTypes = { "unblackbox": SourceActor.prototype.onUnblackBox, "prettyPrint": SourceActor.prototype.onPrettyPrint, "disablePrettyPrint": SourceActor.prototype.onDisablePrettyPrint, - "getExecutableLines": SourceActor.prototype.getExecutableLines + "getExecutableLines": SourceActor.prototype.getExecutableLines, + "setBreakpoint": SourceActor.prototype.onSetBreakpoint }; @@ -3317,17 +3518,18 @@ ObjectActor.prototype = { } const generatedLocation = { - url: this.obj.script.url, + source: this.obj.script.source, line: this.obj.script.startLine, // TODO bug 901138: use Debugger.Script.prototype.startColumn. column: 0 }; return this.threadActor.sources.getOriginalLocation(generatedLocation) - .then(({ url, line, column }) => { + .then(({ sourceActor, line, column }) => { + return { from: this.actorID, - url: url, + source: sourceActor.form(), line: line, column: column }; @@ -4542,19 +4744,21 @@ FrameActor.prototype = { * Returns a frame form for use in a protocol message. */ form: function () { + let threadActor = this.threadActor; let form = { actor: this.actorID, type: this.frame.type }; if (this.frame.type === "call") { - form.callee = this.threadActor.createValueGrip(this.frame.callee); + form.callee = threadActor.createValueGrip(this.frame.callee); } if (this.frame.environment) { - let envActor = this.threadActor - .createEnvironmentActor(this.frame.environment, - this.frameLifetimePool); + let envActor = threadActor.createEnvironmentActor( + this.frame.environment, + this.frameLifetimePool + ); form.environment = envActor.form(); } - form.this = this.threadActor.createValueGrip(this.frame.this); + form.this = threadActor.createValueGrip(this.frame.this); form.arguments = this._args(); if (this.frame.script) { form.where = getFrameLocation(this.frame); @@ -4612,17 +4816,21 @@ FrameActor.prototype.requestTypes = { * * @param ThreadActor aThreadActor * The parent thread actor that contains this breakpoint. - * @param object aLocation - * The location of the breakpoint as specified in the protocol. + * @param object aProperties + * An object with the following properties: + * - sourceActor: A SourceActor that represents the script + * - line: the specified line + * - column: the specified column + * - condition: a condition which, when false, will skip the breakpoint */ -function BreakpointActor(aThreadActor, { url, line, column, condition }) +function BreakpointActor(aThreadActor, { sourceActor, line, column, condition }) { // The set of Debugger.Script instances that this breakpoint has been set // upon. this.scripts = new Set(); this.threadActor = aThreadActor; - this.location = { url: url, line: line, column: column }; + this.location = { sourceActor, line, column }; this.condition = condition; } @@ -4678,12 +4886,10 @@ BreakpointActor.prototype = { hit: function (aFrame) { // Don't pause if we are currently stepping (in or over) or the frame is // black-boxed. - let { url } = this.threadActor.synchronize( - this.threadActor.sources.getOriginalLocation({ - url: this.location.url, - line: this.location.line, - column: this.location.column - })); + let loc = getFrameLocation(aFrame); + let { sourceActor } = this.threadActor.synchronize( + this.threadActor.sources.getOriginalLocation(loc)); + let url = sourceActor.url; if (this.threadActor.sources.isBlackBoxed(url) || aFrame.onStep @@ -4710,7 +4916,9 @@ BreakpointActor.prototype = { */ onDelete: function (aRequest) { // Remove from the breakpoint store. - this.threadActor.breakpointStore.removeBreakpoint(this.location); + this.threadActor.breakpointStore.removeBreakpoint( + update({}, this.location, { source: this.location.sourceActor.form() }) + ); this.threadActor.threadLifetimePool.removeActor(this); // Remove the actual breakpoint from the associated scripts. this.removeScripts(); @@ -4722,7 +4930,6 @@ BreakpointActor.prototype.requestTypes = { "delete": BreakpointActor.prototype.onDelete }; - /** * Creates an EnvironmentActor. EnvironmentActors are responsible for listing * the bindings introduced by a lexical environment and assigning new values to @@ -4991,7 +5198,10 @@ update(ChromeDebuggerActor.prototype, { * Override the eligibility check for scripts and sources to make sure every * script and source with a URL is stored when debugging chrome. */ - _allowSource: aSourceURL => !!aSourceURL + + _allowSource: function(aSource) { + return !isHiddenSource(aSource); + } }); exports.ChromeDebuggerActor = ChromeDebuggerActor; @@ -5026,14 +5236,15 @@ update(AddonThreadActor.prototype, { * sure every script and source with a URL is stored when debugging * add-ons. */ - _allowSource: function(aSourceURL) { - // Hide eval scripts - if (!aSourceURL) { + _allowSource: function(aSource) { + let url = aSource.url; + + if (isHiddenSource(aSource)) { return false; } // XPIProvider.jsm evals some code in every add-on's bootstrap.js. Hide it. - if (aSourceURL == "resource://gre/modules/addons/XPIProvider.jsm") { + if (url === "resource://gre/modules/addons/XPIProvider.jsm") { return false; } @@ -5055,15 +5266,16 @@ function ThreadSources(aThreadActor, aOptions, aAllowPredicate, this._autoBlackBox = aOptions.autoBlackBox; this._allow = aAllowPredicate; this._onNewSource = aOnNewSource; + this._anonSourceMapId = 1; - // generated source url --> promise of SourceMapConsumer - this._sourceMapsByGeneratedSource = Object.create(null); - // original source url --> promise of SourceMapConsumer - this._sourceMapsByOriginalSource = Object.create(null); - // source url --> SourceActor - this._sourceActors = Object.create(null); - // original url --> generated url - this._generatedUrlsByOriginalUrl = Object.create(null); + // generated Debugger.Source -> promise of SourceMapConsumer + this._sourceMaps = new Map(); + // sourceMapURL -> promise of SourceMapConsumer + this._sourceMapCache = Object.create(null); + // Debugger.Source -> SourceActor + this._sourceActors = new Map(); + // url -> SourceActor + this._sourceMappedSourceActors = Object.create(null); } /** @@ -5075,57 +5287,142 @@ const MINIFIED_SOURCE_REGEXP = /\bmin\.js$/; ThreadSources.prototype = { /** - * Return the source actor representing |url|, creating one if none - * exists already. Returns null if |url| is not allowed by the 'allow' - * predicate. + * Return the source actor representing the `source` (or + * `originalUrl`), creating one if none exists already. May return + * null if the source is disallowed. * - * Right now this takes a URL, but in the future it should - * take a Debugger.Source. See bug 637572. - * - * @param String url - * The source URL. - * @param optional SourceMapConsumer sourceMap - * The source map that introduced this source, if any. - * @param optional String generatedSource - * The generated source url that introduced this source via source map, + * @param Debugger.Source source + * The source to make an actor for + * @param String originalUrl + * The original source URL of a sourcemapped source + * @param optional Debguger.Source generatedSource + * The generated source that introduced this source via source map, * if any. - * @param optional String text - * The text content of the source, if immediately available. * @param optional String contentType * The content type of the source, if immediately available. - * @returns a SourceActor representing the source at aURL or null. + * @returns a SourceActor representing the source or null. */ - source: function ({ url, sourceMap, generatedSource, text, contentType }) { - if (!this._allow(url)) { - return null; - } + source: function ({ source, originalUrl, generatedSource, + isInlineSource, contentType }) { + dbg_assert(source || (originalUrl && generatedSource), + "ThreadSources.prototype.source needs an originalUrl or a source"); - if (url in this._sourceActors) { - return this._sourceActors[url]; - } + if (source) { + // If a source is passed, we are creating an actor for a real + // source, which may or may not be sourcemapped. - if (this._autoBlackBox && this._isMinifiedURL(url)) { - this.blackBox(url); + if (!this._allow(source)) { + return null; + } + + // It's a hack, but inline HTML scripts each have real sources, + // but we want to represent all of them as one source as the + // HTML page. The actor representing this fake HTML source is + // stored in this array, which always has a URL, so check it + // first. + if (source.url in this._sourceMappedSourceActors) { + return this._sourceMappedSourceActors[source.url]; + } + + if (isInlineSource) { + // If it's an inline source, the fake HTML source hasn't been + // created yet (would have returned above), so flip this source + // into a sourcemapped state by giving it an `originalUrl` which + // is the HTML url. + originalUrl = source.url; + source = null; + } + else if (this._sourceActors.has(source)) { + return this._sourceActors.get(source); + } + } + else if (originalUrl) { + // Not all "original" scripts are distinctly separate from the + // generated script. Pretty-printed sources have a sourcemap for + // themselves, so we need to make sure there a real source + // doesn't already exist with this URL. + for (let [source, actor] of this._sourceActors) { + if (source.url === originalUrl) { + return actor; + } + } + + if (originalUrl in this._sourceMappedSourceActors) { + return this._sourceMappedSourceActors[originalUrl]; + } } let actor = new SourceActor({ - url: url, thread: this._thread, - sourceMap: sourceMap, + source: source, + originalUrl: originalUrl, generatedSource: generatedSource, - text: text, contentType: contentType }); - this._thread.threadLifetimePool.addActor(actor); - this._sourceActors[url] = actor; - try { - this._onNewSource(actor); - } catch (e) { - reportError(e); + + let sourceActorStore = this._thread.sourceActorStore; + var id = sourceActorStore.getReusableActorId(source, originalUrl); + if (id) { + actor.actorID = id; } + + this._thread.threadLifetimePool.addActor(actor); + sourceActorStore.setReusableActorId(source, originalUrl, actor.actorID); + + if (this._autoBlackBox && this._isMinifiedURL(actor.url)) { + this.blackBox(actor.url); + } + + if (source) { + this._sourceActors.set(source, actor); + } + else { + this._sourceMappedSourceActors[originalUrl] = actor; + } + + // Don't notify a new source if it's a generated one, as it has + // sourcemapped sources. The generated one is created to set + // breakpoints. + if (!source || !this._sourceMaps.has(source)) { + try { + this._onNewSource(actor); + } catch (e) { + reportError(e); + } + } + return actor; }, + getSource: function(source) { + if (source.url in this._sourceMappedSourceActors) { + return this._sourceMappedSourceActors[source.url]; + } + + if (this._sourceActors.has(source)) { + return this._sourceActors.get(source); + } + + throw new Error('getSource: could not find source actor for ' + + (source.url || 'source')); + }, + + getSourceByURL: function(url) { + if (url) { + for (let [source, actor] of this._sourceActors) { + if (source.url === url) { + return actor; + } + } + + if (url in this._sourceMappedSourceActors) { + return this._sourceMappedSourceActors[url]; + } + } + + throw new Error('getSourceByURL: could not find source for ' + url); + }, + /** * Returns true if the URL likely points to a minified resource, false * otherwise. @@ -5150,33 +5447,34 @@ ThreadSources.prototype = { * Only to be used when we aren't source mapping. */ _sourceForScript: function (aScript) { - const spec = { - url: aScript.url + let url = getSourceURL(aScript.source); + let spec = { + source: aScript.source }; - // XXX bug 915433: We can't rely on Debugger.Source.prototype.text if the - // source is an HTML-embedded + + + + + + +This image is going to load + + + + diff --git a/dom/camera/test/callback/test_camera_hardware_init_failure.html b/dom/camera/test/callback/test_camera_hardware_init_failure.html index 3962722180b3..21741452e450 100644 --- a/dom/camera/test/callback/test_camera_hardware_init_failure.html +++ b/dom/camera/test/callback/test_camera_hardware_init_failure.html @@ -65,11 +65,64 @@ var tests = [ info("Running test: init-success"); navigator.mozCameras.getCamera(whichCamera, initialConfig, onSuccess, onError) } - } + }, + /* Test for bug 1099390 to make sure events related to the underlying + platform failing are generated and handled properly. */ + { + name: "post-init-system-failure", + key: "post-init-system-failure", + func: function(test) { + var gotReleaseCallback = false; + var gotCloseCallback = false; + + function gotAll() { + var all = gotReleaseCallback && gotCloseCallback; + if (all) { + info("Got all expected notifications"); + } + return all; + } + + function onSuccess(camera, config) { + camera.onClosed = function(reason) { + camera.onClosed = null; + ok(reason === "SystemFailure", "reason is: " + reason); + ok(!gotCloseCallback, "gotCloseCallback was " + gotCloseCallback); + gotCloseCallback = true; + if (gotAll()) { + test.next(); + } + + camera.release( + function success() { + ok(true, "Got release() success callback"); + ok(!gotReleaseCallback, "gotReleaseCallback was " + gotReleaseCallback); + gotReleaseCallback = true; + if (gotAll()) { + test.next(); + } + }, + function error(e) { + ok(false, "Unexpected release() onError callback: " + e); + test.next(); + } + ); // release() + } // onClosed + } // onSuccess + + function onError(error) { + ok(false, "onError called incorrectly: " + error); + test.next(); + } + + info("Running test: post-init-system-failure"); + navigator.mozCameras.getCamera(whichCamera, initialConfig, onSuccess, onError); + } + }, ]; var testGenerator = function() { - for (var i = 0; i < tests.length; ++i ) { + for (var i = 0; i < tests.length; ++i) { yield tests[i]; } }(); diff --git a/dom/camera/test/mochitest.ini b/dom/camera/test/mochitest.ini index fb79e9091cc8..8abd8ed51d06 100644 --- a/dom/camera/test/mochitest.ini +++ b/dom/camera/test/mochitest.ini @@ -10,6 +10,7 @@ support-files = camera_common.js [callback/test_camera_hardware_face_detection.html] [callback/test_camera_hardware_auto_focus_moving_cb.html] [callback/test_bug1022766.html] +[callback/test_bug1099390.html] [test_camera.html] [test_camera_2.html] [test_camera_3.html] @@ -21,3 +22,4 @@ support-files = camera_common.js [test_camera_hardware_auto_focus_moving_cb.html] [test_bug1022766.html] [test_bug1037322.html] +[test_bug1099390.html] diff --git a/dom/camera/test/test_bug1099390.html b/dom/camera/test/test_bug1099390.html new file mode 100644 index 000000000000..602a4547b93d --- /dev/null +++ b/dom/camera/test/test_bug1099390.html @@ -0,0 +1,108 @@ + + + + Test for bug 1099390 + + + + + + + +This image is going to load + + + + diff --git a/dom/camera/test/test_camera_hardware_init_failure.html b/dom/camera/test/test_camera_hardware_init_failure.html index 12b76dfee5ee..42b9b17f00db 100644 --- a/dom/camera/test/test_camera_hardware_init_failure.html +++ b/dom/camera/test/test_camera_hardware_init_failure.html @@ -55,8 +55,7 @@ var tests = [ func: function(test) { function onSuccess(d) { ok(true, "onSuccess called correctly"); - d.camera.release(); - test.next(); + d.camera.release().then(test.next); } function onError(error) { ok(false, "onError called incorrectly: " + error); @@ -65,11 +64,66 @@ var tests = [ info("Running test: init-success"); navigator.mozCameras.getCamera(whichCamera, initialConfig).then(onSuccess, onError) } - } + }, + /* Test for bug 1099390 to make sure events related to the underlying + platform failing are generated and handled properly. */ + { + name: "post-init-system-failure", + key: "post-init-system-failure", + func: function(test) { + var gotReleasePromise = false; + var gotCloseEvent = false; + + function gotAll() { + var all = gotReleasePromise && gotCloseEvent; + if (all) { + info("Got all expected notifications"); + } + return all; + } + + function onSuccess(d) { + var onClosedEvent = function(e) { + d.camera.removeEventListener('close', onClosedEvent); + + ok(e.reason === "SystemFailure", "reason is: " + e.reason); + ok(!gotCloseEvent, "gotCloseEvent was " + gotCloseEvent); + gotCloseEvent = true; + if (gotAll()) { + test.next(); + } + + d.camera.release().then( + function resolve(e) { + ok(true, "release() promise resolved"); + ok(!gotReleasePromise, "gotReleasePromise was " + gotReleasePromise); + gotReleasePromise = true; + if (gotAll()) { + test.next(); + } + }, + function reject(e) { + ok(false, "release() promise unexpected rejected: " + e); + } + ); + }; + + d.camera.addEventListener('close', onClosedEvent); + } + + function onError(error) { + ok(false, "onError called incorrectly: " + error); + test.next(); + } + + info("Running test: post-init-system-failure"); + navigator.mozCameras.getCamera(whichCamera, initialConfig).then(onSuccess, onError) + } + }, ]; var testGenerator = function() { - for (var i = 0; i < tests.length; ++i ) { + for (var i = 0; i < tests.length; ++i) { yield tests[i]; } }(); diff --git a/dom/events/test/test_all_synthetic_events.html b/dom/events/test/test_all_synthetic_events.html index 11bacaecd6fe..cc4246dffa49 100644 --- a/dom/events/test/test_all_synthetic_events.html +++ b/dom/events/test/test_all_synthetic_events.html @@ -80,6 +80,10 @@ const kEventConstructors = { return new CallGroupErrorEvent(aName, aProps); }, }, + CameraClosedEvent: { create: function (aName, aProps) { + return new CameraClosedEvent(aName, aProps); + }, + }, CameraConfigurationEvent: { create: function (aName, aProps) { return new CameraConfigurationEvent(aName, aProps); }, diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 35898cf01bac..4242985d6b0a 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -341,7 +341,8 @@ MediaEngineGonkVideoSource::StopImpl() { } void -MediaEngineGonkVideoSource::OnHardwareStateChange(HardwareState aState) +MediaEngineGonkVideoSource::OnHardwareStateChange(HardwareState aState, + nsresult aReason) { ReentrantMonitorAutoEnter sync(mCallbackMonitor); if (aState == CameraControlListener::kHardwareClosed) { diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.h b/dom/media/webrtc/MediaEngineGonkVideoSource.h index da7aa2702346..8e96ef39ef84 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.h +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.h @@ -45,8 +45,8 @@ public: MediaEngineGonkVideoSource(int aIndex) : MediaEngineCameraVideoSource(aIndex, "GonkCamera.Monitor") - , mCameraControl(nullptr) , mCallbackMonitor("GonkCamera.CallbackMonitor") + , mCameraControl(nullptr) , mRotation(0) , mBackCamera(false) , mOrientationChanged(true) // Correct the orientation at first time takePhoto. @@ -70,11 +70,11 @@ public: return true; } - void OnHardwareStateChange(HardwareState aState); + void OnHardwareStateChange(HardwareState aState, nsresult aReason) MOZ_OVERRIDE; void GetRotation(); - bool OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight); - void OnUserError(UserContext aContext, nsresult aError); - void OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType); + bool OnNewPreviewFrame(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight) MOZ_OVERRIDE; + void OnUserError(UserContext aContext, nsresult aError) MOZ_OVERRIDE; + void OnTakePictureComplete(uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) MOZ_OVERRIDE; void AllocImpl(); void DeallocImpl(); diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index bdbd2761feca..556490184bf4 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -205,6 +205,8 @@ var interfaceNamesInGlobalScope = {name: "CallGroupErrorEvent", b2g: true, pref: "dom.telephony.enabled"}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "CameraCapabilities", b2g: true}, +// IMPORTANT: Do not change this list without review from a DOM peer! + {name: "CameraClosedEvent", b2g: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "CameraConfigurationEvent", b2g: true}, // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/dom/webidl/CameraClosedEvent.webidl b/dom/webidl/CameraClosedEvent.webidl new file mode 100644 index 000000000000..0452bfb35e72 --- /dev/null +++ b/dom/webidl/CameraClosedEvent.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +[Func="Navigator::HasCameraSupport", + Constructor(DOMString type, optional CameraClosedEventInit eventInitDict)] +interface CameraClosedEvent : Event +{ + readonly attribute DOMString reason; +}; + +dictionary CameraClosedEventInit : EventInit +{ + DOMString reason = "HardwareReleased"; +}; diff --git a/dom/webidl/CameraControl.webidl b/dom/webidl/CameraControl.webidl index 0bbc4bdb882f..d95849cf3774 100644 --- a/dom/webidl/CameraControl.webidl +++ b/dom/webidl/CameraControl.webidl @@ -116,7 +116,7 @@ callback CameraAutoFocusCallback = void (boolean focused); callback CameraTakePictureCallback = void (Blob picture); callback CameraStartRecordingCallback = void (); callback CameraShutterCallback = void (); -callback CameraClosedCallback = void (); +callback CameraClosedCallback = void (DOMString reason); callback CameraReleaseCallback = void (); callback CameraRecorderStateChange = void (DOMString newState); callback CameraPreviewStateChange = void (DOMString newState); @@ -241,16 +241,27 @@ interface CameraControl : MediaStream contains no event-specific data. */ attribute EventHandler onshutter; - /* the function to call when the camera hardware is closed - by the underlying framework, e.g. when another app makes a more - recent call to get the camera. */ + /* the function to call when the camera hardware is closed; this may + be due to a system failure, another process taking over the camera, + or a call to release(). + + The 'reason' will be one of the following string values: + - SystemFailure : the camera subsystem failed and was closed; + - HardwareReleased : a call to release() was successful; + - NotAvailable : the camera hardware is in use by another process. + */ attribute CameraClosedCallback? onClosed; - /* the event dispatched when the camera hardware is closed - by the underlying framework, e.g. when another app makes a more - recent call to get the camera. + /* the event dispatched when the camera hardware is closed; this may + be due to a system failure, another process taking over the camera, + or a call to release(). - contains no event-specific data. */ + The event has a 'reason' attribute that will be one of the following + string values: + - SystemFailure : the camera subsystem failed and was closed; + - HardwareReleased : a call to release() was successful; + - NotAvailable : the camera hardware is in use by another process. + */ attribute EventHandler onclose; /* the function to call when the recorder changes state, either because diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index b8a046e3fdd3..f26bd3616432 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -681,6 +681,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [ 'BlobEvent.webidl', 'CallEvent.webidl', 'CallGroupErrorEvent.webidl', + 'CameraClosedEvent.webidl', 'CameraConfigurationEvent.webidl', 'CameraFacesDetectedEvent.webidl', 'CameraStateChangeEvent.webidl', From d1668f0876b570ddad21485869531ea136cf092e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 12:10:56 -0800 Subject: [PATCH 053/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9984b271203d Author: autolander Desc: Bug 1103589 - merge pull request #26425 from KevinGrandon:bug_1103589_private_browser_new_window to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/41a3c1896279 Author: Kevin Grandon Desc: Bug 1103589 - Support window.open calls from a private browser r=gduan --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 8fefdee7d355..d639a198a9ec 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "2a664cbb4d735d9c55fc5b6cf3e39a24bcfbe551", + "revision": "9984b271203da479158900409be3c74ec91de9a5", "repo_path": "integration/gaia-central" } From 4590cff8a1c844cf2d7e29aae3e513ade4a27aa3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 12:17:48 -0800 Subject: [PATCH 054/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index fdfc14aee14e..676d2d47db51 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 65983bc514b6..eeb9338208fd 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 51bed0f2f9ea..1176dc50df77 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d994b254dfc8..0459090b286d 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 65983bc514b6..eeb9338208fd 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index f104b04b2410..0356e856648e 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 7acbc6194765..4c757404a43b 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 536133c99dd5..de5541ba1f6b 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 01acde9491d4..396d7f59176e 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 5ef187d9520c..0cf330a65aec 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 946b33fd6b67..59ca6259666e 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 8aafbd8234c3d5b615ae005bec8693d7845c0ad0 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 25 Nov 2014 15:26:48 -0500 Subject: [PATCH 055/121] Bug 1104099 - Exclude non-visible frames from the LayerEventRegions. r=mstange,tn --- layout/base/nsDisplayList.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 5c650ba25f56..d3e050e01c47 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -2957,6 +2957,9 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder, if (pointerEvents == NS_STYLE_POINTER_EVENTS_NONE) { return; } + if (!aFrame->StyleVisibility()->IsVisible()) { + return; + } // XXX handle other pointerEvents values for SVG // XXX Do something clever here for the common case where the border box // is obviously entirely inside mHitRegion. From 6e9873c6d7006c2925d295911b48c4796d5a0847 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 13:41:54 -0800 Subject: [PATCH 056/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/d1f177a8ba5d Author: Kevin Grandon Desc: Merge pull request #26453 from KevinGrandon/bug_1102204_search_escape_providers Bug 1102204 - Update search provider rendering ======== https://hg.mozilla.org/integration/gaia-central/rev/62745a2d69b7 Author: Kevin Grandon Desc: Bug 1102204 - Update search provider rendering r=kgrandon --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d639a198a9ec..2e4c0790f0bb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "9984b271203da479158900409be3c74ec91de9a5", + "revision": "d1f177a8ba5d4fe612e11b57a779a53608724fcb", "repo_path": "integration/gaia-central" } From 65faf4b528b5c26a93c81299819db82df5672346 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 13:47:04 -0800 Subject: [PATCH 057/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 676d2d47db51..4d0e652c1b01 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index eeb9338208fd..4e9f01e10e78 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 1176dc50df77..f1d29ed293ea 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 0459090b286d..16a0e9db0460 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index eeb9338208fd..4e9f01e10e78 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 0356e856648e..b1b24baa382c 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 4c757404a43b..7e26d47f91f3 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index de5541ba1f6b..73eab08a58b4 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 396d7f59176e..23297f4ab469 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 0cf330a65aec..a4d24e13b5f6 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 59ca6259666e..f34a11e9d06d 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 9b9c9319d42259de02b6e5ff4975089f940cda77 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 25 Nov 2014 17:05:39 -0500 Subject: [PATCH 058/121] Bug 1104809 - Log accumulation of event regions into a PaintedLayer. r=mstange,tn --- layout/base/FrameLayerBuilder.cpp | 48 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 20470ca88dd8..4e4140bc84b8 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -268,6 +268,20 @@ public: mNewChildLayersIndex(-1), mAllDrawingAbove(false) {} + +#ifdef MOZ_DUMP_PAINTING + /** + * Keep track of important decisions for debugging. + */ + nsAutoCString mLog; + + #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \ + tld->mLog.AppendPrintf("\t\t\t\t"); \ + tld->mLog.AppendPrintf(__VA_ARGS__); +#else + #define FLB_LOG_PAINTED_LAYER_DECISION(...) +#endif + /** * Record that an item has been added to the PaintedLayer, so we * need to update our regions. @@ -290,16 +304,16 @@ public: const nsIFrame* GetAnimatedGeometryRoot() { return mAnimatedGeometryRoot; } /** - * Add aHitRegion, aMaybeHitRegion, and aDispatchToContentHitRegion to the - * hit regions for this PaintedLayer. + * Add the given hit regions to the hit regions to the hit retions for this + * PaintedLayer. */ - void AccumulateEventRegions(const nsRegion& aHitRegion, - const nsRegion& aMaybeHitRegion, - const nsRegion& aDispatchToContentHitRegion) + void AccumulateEventRegions(nsDisplayLayerEventRegions* aEventRegions) { - mHitRegion.Or(mHitRegion, aHitRegion); - mMaybeHitRegion.Or(mMaybeHitRegion, aMaybeHitRegion); - mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aDispatchToContentHitRegion); + FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating event regions %p against tld=%p\n", aEventRegions, this); + + mHitRegion.Or(mHitRegion, aEventRegions->HitRegion()); + mMaybeHitRegion.Or(mMaybeHitRegion, aEventRegions->MaybeHitRegion()); + mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aEventRegions->DispatchToContentHitRegion()); } /** @@ -374,20 +388,6 @@ public: return mFixedPosFrameForLayerData != nullptr; } -#ifdef MOZ_DUMP_PAINTING - - /** - * Keep track of important decisions for debugging. - */ - nsAutoCString mLog; - - #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \ - tld->mLog.AppendPrintf("\t\t\t\t"); \ - tld->mLog.AppendPrintf(__VA_ARGS__); -#else - #define FLB_LOG_PAINTED_LAYER_DECISION(...) -#endif - /** * The region of visible content in the layer, relative to the * container layer (which is at the snapped top-left of the display @@ -3055,9 +3055,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) { nsDisplayLayerEventRegions* eventRegions = static_cast(item); - paintedLayerData->AccumulateEventRegions(eventRegions->HitRegion(), - eventRegions->MaybeHitRegion(), - eventRegions->DispatchToContentHitRegion()); + paintedLayerData->AccumulateEventRegions(eventRegions); } else { // check to see if the new item has rounded rect clips in common with // other items in the layer From baccad357d61064b714f2ff093d6d110c6f0bebb Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 25 Nov 2014 17:05:58 -0500 Subject: [PATCH 059/121] Bug 1104809 - When building display lists for non-stacking children don't discard the event regions. r=mstange,tn --- layout/generic/nsFrame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 2e34ae52d123..59a03eff9840 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2429,8 +2429,9 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, nsIFrame *animatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(child); if (animatedGeometryRoot != buildingForChild.GetPrevAnimatedGeometryRoot()) { nsDisplayLayerEventRegions* eventRegions = - new (aBuilder) nsDisplayLayerEventRegions(aBuilder, this); + new (aBuilder) nsDisplayLayerEventRegions(aBuilder, child); aBuilder->SetLayerEventRegions(eventRegions); + aLists.BorderBackground()->AppendNewToTop(eventRegions); } } From f62854332304fde0e977e975db732e6cb88edc9e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 14:26:53 -0800 Subject: [PATCH 060/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9641667526a4 Author: autolander Desc: Bug 1104991 - merge pull request #26458 from KevinGrandon:bug_1104991_update_gaia_readme to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/8d9ea178842e Author: Kevin Grandon Desc: Bug 1104991 - Update gaia README to include autolander details --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2e4c0790f0bb..d63f9eeb474f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "d1f177a8ba5d4fe612e11b57a779a53608724fcb", + "revision": "9641667526a4dc9dc06f72fadca04f4b2abb8ac5", "repo_path": "integration/gaia-central" } From b6d87f4e3fc324e5a8c75e24cd15bbd4aa27d32e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 14:31:57 -0800 Subject: [PATCH 061/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 4d0e652c1b01..39da61736928 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4e9f01e10e78..05af4e80c634 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index f1d29ed293ea..7fa57c3599db 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 16a0e9db0460..96b76459b318 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4e9f01e10e78..05af4e80c634 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b1b24baa382c..7fb53c6b47a8 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 7e26d47f91f3..51c2972eb3e7 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 73eab08a58b4..0af4482fd9aa 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 23297f4ab469..31fc0737f916 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index a4d24e13b5f6..7ec1d51190ce 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index f34a11e9d06d..cd8a09dd6634 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 8b4ed5c7980b3a620a85a0228ed640801ca825b3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 15:11:55 -0800 Subject: [PATCH 062/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/aded56382c23 Author: Kevin Grandon Desc: Merge pull request #26096 from KevinGrandon/bug_1098149_upgrade_jshint Bug 1098149 - Upgrade jshint to 2.5.10 ======== https://hg.mozilla.org/integration/gaia-central/rev/d556515bcfc1 Author: Kevin Grandon Desc: Bug 1098149 - Upgrade jshint to 2.5.10 r=kgrandon --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d63f9eeb474f..63bfbe6dfad7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "9641667526a4dc9dc06f72fadca04f4b2abb8ac5", + "revision": "aded56382c2339915223441b0545bd3d41ec44f1", "repo_path": "integration/gaia-central" } From 7ddf3d2c84b3e1110c41a2c77789dd3b112fb978 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 15:22:00 -0800 Subject: [PATCH 063/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 39da61736928..46fac5fb1a53 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 05af4e80c634..4e768e193df1 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 7fa57c3599db..a6caf3fa2d93 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 96b76459b318..f7f463439edb 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 05af4e80c634..4e768e193df1 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 7fb53c6b47a8..8ee21dde9cae 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 51c2972eb3e7..01eb891cbd91 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 0af4482fd9aa..b2263bf7a5f9 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 31fc0737f916..16fd1aac6e13 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 7ec1d51190ce..013b24137579 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index cd8a09dd6634..f443228fc9e4 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 714f5ab964afd99a8a1240382201dc220ead3338 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 16:31:56 -0800 Subject: [PATCH 064/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e772df7d241c Author: russnicoletti Desc: Merge pull request #26127 from russnicoletti/bug-1095832 Bug 1095832 - [RTL][Video] Progress slider position moves opposite from progress bar r=djf ======== https://hg.mozilla.org/integration/gaia-central/rev/fbe01541c54b Author: Russ Nicoletti Desc: Bug 1095832 - [RTL][Video] Progress slider position moves opposite from slider progress --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 63bfbe6dfad7..9b045e11a08e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "aded56382c2339915223441b0545bd3d41ec44f1", + "revision": "e772df7d241cd605f32daccf1c7cabc86b433c0c", "repo_path": "integration/gaia-central" } From 5a3c82ec527a6b982941be537e13b5c138485c50 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 16:37:00 -0800 Subject: [PATCH 065/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 46fac5fb1a53..9bac95a3fdc2 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4e768e193df1..bf4a3e3446b0 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index a6caf3fa2d93..0ebb8c5a9106 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index f7f463439edb..16a616ac4c6c 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4e768e193df1..bf4a3e3446b0 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 8ee21dde9cae..e162d06f5403 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 01eb891cbd91..6b4b09f3fcfe 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b2263bf7a5f9..7b30c1012a63 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 16fd1aac6e13..b849716ecaf0 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 013b24137579..cbc2b2b5bae8 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index f443228fc9e4..9d2f8263a712 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 47ce7a8a57bbbe962bcbc5ba051d9857049a3561 Mon Sep 17 00:00:00 2001 From: Dimi Lee Date: Tue, 25 Nov 2014 15:10:34 +0800 Subject: [PATCH 066/121] Bug 1095322 - Child process should know current rf state of NFC HW. r=allstars.chh --- dom/nfc/NfcContentHelper.js | 12 ++++++++++++ dom/nfc/gonk/Nfc.js | 23 ++++++++++++++++++----- dom/nfc/gonk/nfc_consts.js | 1 + dom/nfc/nsINfcContentHelper.idl | 17 +++++++++++++++-- dom/nfc/nsNfc.js | 6 ++++++ 5 files changed, 52 insertions(+), 7 deletions(-) diff --git a/dom/nfc/NfcContentHelper.js b/dom/nfc/NfcContentHelper.js index 9a2a938f2713..362a7ae8311f 100644 --- a/dom/nfc/NfcContentHelper.js +++ b/dom/nfc/NfcContentHelper.js @@ -89,6 +89,7 @@ NfcContentHelper.prototype = { _window: null, _requestMap: null, + _rfState: null, eventListener: null, init: function init(aWindow) { @@ -107,6 +108,13 @@ NfcContentHelper.prototype = { updateDebug(); }; } + + let info = cpmm.sendSyncMessage("NFC:QueryInfo")[0]; + this._rfState = info.rfState; + }, + + queryRFState: function queryRFState() { + return this._rfState; }, encodeNDEFRecords: function encodeNDEFRecords(records) { @@ -319,6 +327,10 @@ NfcContentHelper.prototype = { case NFC.TAG_EVENT_LOST: this.eventListener.notifyTagLost(result.sessionToken); break; + case NFC.RF_EVENT_STATE_CHANGE: + this._rfState = result.rfState; + this.eventListener.notifyRFStateChange(this._rfState); + break; } break; } diff --git a/dom/nfc/gonk/Nfc.js b/dom/nfc/gonk/Nfc.js index 2e5f3d4b24bd..55059fb4fa8b 100644 --- a/dom/nfc/gonk/Nfc.js +++ b/dom/nfc/gonk/Nfc.js @@ -59,7 +59,8 @@ const NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES = [ ]; const NFC_IPC_MSG_NAMES = [ - "NFC:CheckSessionToken" + "NFC:CheckSessionToken", + "NFC:QueryInfo" ]; const NFC_IPC_READ_PERM_MSG_NAMES = [ @@ -268,6 +269,13 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () { } }, + onRFStateChange: function onRFStateChange(rfState) { + for (let target of this.eventListeners) { + this.notifyDOMEvent(target, { event: NFC.RF_EVENT_STATE_CHANGE, + rfState: rfState}); + } + }, + /** * nsIMessageListener interface methods. */ @@ -557,11 +565,12 @@ Nfc.prototype = { this.notifyHCIEventTransaction(message); break; case "ChangeRFStateResponse": + this.sendNfcResponse(message); + if (!message.errorMsg) { this.rfState = message.rfState; + gMessageManager.onRFStateChange(this.rfState); } - - this.sendNfcResponse(message); break; case "ConnectResponse": // Fall through. case "CloseResponse": @@ -602,13 +611,15 @@ Nfc.prototype = { receiveMessage: function receiveMessage(message) { let isRFAPI = message.name == "NFC:ChangeRFState"; let isSendFile = message.name == "NFC:SendFile"; - if (!isRFAPI && (this.rfState != NFC.NFC_RF_STATE_DISCOVERY)) { + let isInfoAPI = message.name == "NFC:QueryInfo"; + + if (!isRFAPI && !isInfoAPI && (this.rfState != NFC.NFC_RF_STATE_DISCOVERY)) { debug("NFC is not enabled. current rfState:" + this.rfState); this.sendNfcErrorResponse(message, NFC.NFC_GECKO_ERROR_NOT_ENABLED); return null; } - if (!isRFAPI && !isSendFile) { + if (!isRFAPI && !isSendFile && !isInfoAPI) { // Update the current sessionId before sending to the NFC service. message.data.sessionId = SessionHelper.getId(message.data.sessionToken); } @@ -647,6 +658,8 @@ Nfc.prototype = { gSystemMessenger.broadcastMessage("nfc-manager-send-file", message.data); break; + case "NFC:QueryInfo": + return {rfState: this.rfState}; default: debug("UnSupported : Message Name " + message.name); return null; diff --git a/dom/nfc/gonk/nfc_consts.js b/dom/nfc/gonk/nfc_consts.js index 097357ec1299..41f116e836a7 100644 --- a/dom/nfc/gonk/nfc_consts.js +++ b/dom/nfc/gonk/nfc_consts.js @@ -51,6 +51,7 @@ this.PEER_EVENT_LOST = 0x02; this.TAG_EVENT_FOUND = 0x03; this.TAG_EVENT_LOST = 0x04; this.PEER_EVENT_FOUND = 0x05; +this.RF_EVENT_STATE_CHANGE = 0x06; // Allow this file to be imported via Components.utils.import(). this.EXPORTED_SYMBOLS = Object.keys(this); diff --git a/dom/nfc/nsINfcContentHelper.idl b/dom/nfc/nsINfcContentHelper.idl index 1e0c7f8d4712..a63edb8795cc 100644 --- a/dom/nfc/nsINfcContentHelper.idl +++ b/dom/nfc/nsINfcContentHelper.idl @@ -22,7 +22,7 @@ interface nsINfcTagEvent : nsISupports readonly attribute boolean isFormatable; }; -[scriptable, uuid(42c7a85f-59ae-4bde-b961-e1f1436476c3)] +[scriptable, uuid(fcbd98d6-3d04-4657-bd64-1164e311b399)] interface nsINfcEventListener : nsISupports { /** @@ -63,6 +63,14 @@ interface nsINfcEventListener : nsISupports * SessionToken received from parent process */ void notifyPeerLost(in DOMString sessionToken); + + /** + * Callback function used to notify RF state change. + * + * @param rfState + * RF state received from parent process + */ + void notifyRFStateChange(in DOMString rfState); }; [scriptable, uuid(a8ef3590-d853-4766-b54a-a4547da4dde4)] @@ -79,7 +87,7 @@ interface nsINfcRequestCallback : nsISupports void notifyError(in DOMString errorMsg); }; -[scriptable, uuid(9da02537-c4d0-4b2d-b294-d3250ff1720e)] +[scriptable, uuid(bcf214de-885b-43e6-9e53-9b7d880e1633)] interface nsINfcContentHelper : nsISupports { void init(in nsIDOMWindow window); @@ -166,6 +174,11 @@ interface nsINfcContentHelper : nsISupports void close(in DOMString sessionToken, in nsINfcRequestCallback callback); + /** + * Get current RF state. + */ + DOMString queryRFState(); + /** * Initiate send file operation. * diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 921caa59857d..4bc21a7c843d 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -265,6 +265,7 @@ function MozNFCImpl() { MozNFCImpl.prototype = { _nfcContentHelper: null, _window: null, + _rfState: null, nfcPeer: null, nfcTag: null, eventService: null, @@ -287,6 +288,7 @@ MozNFCImpl.prototype = { if (this._nfcContentHelper) { this._nfcContentHelper.init(aWindow); + this._rfState = this._nfcContentHelper.queryRFState(); } }, @@ -520,6 +522,10 @@ MozNFCImpl.prototype = { } }, + notifyRFStateChange: function notifyRFStateChange(rfState) { + this._rfState = rfState; + }, + checkPermissions: function checkPermissions(perms) { let principal = this._window.document.nodePrincipal; for (let perm of perms) { From 678eb44f8fb6efdd7e5669f1acfe6f2d38137d5e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 19:51:55 -0800 Subject: [PATCH 067/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0ae677ae34c3 Author: Arthur Chen Desc: Merge pull request #26395 from crh0716/1102156 Bug 1102156 - Fix RTL issue for apn items r=eragonj ======== https://hg.mozilla.org/integration/gaia-central/rev/fa1906ef260c Author: Arthur Chen Desc: Bug 1102156 - Fix RTL issue for apn items --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 9b045e11a08e..992ec938593a 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e772df7d241cd605f32daccf1c7cabc86b433c0c", + "revision": "0ae677ae34c305d2b26fc1f2f74de10895a562ba", "repo_path": "integration/gaia-central" } From bb5d0cbc3530927e3e8f13c0dd818f37d746e551 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 19:57:00 -0800 Subject: [PATCH 068/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 9bac95a3fdc2..c247267be5e0 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index bf4a3e3446b0..0bc9f5c9f02b 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0ebb8c5a9106..7d078791546a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 16a616ac4c6c..b22dd227e79b 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index bf4a3e3446b0..0bc9f5c9f02b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index e162d06f5403..c51dd64e84ad 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 6b4b09f3fcfe..e65d4cc2ebc6 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 7b30c1012a63..154e964775af 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index b849716ecaf0..60fae030d421 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index cbc2b2b5bae8..9dc3f322254b 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 9d2f8263a712..631403e13604 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 95e6c95056953d470c1883ae9278c0a7629fe4d2 Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Mon, 17 Nov 2014 17:41:18 +0800 Subject: [PATCH 069/121] Bug 1103729 - Create nfc-manager-send-file wrapper. r=dimi --- dom/nfc/nsNfc.js | 22 +++++++++++++++++++++- dom/nfc/nsNfc.manifest | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 4bc21a7c843d..42d0e145ae89 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -553,5 +553,25 @@ MozNFCImpl.prototype = { Ci.nsIDOMEventListener]), }; +function NFCSendFileWrapper() { +} +NFCSendFileWrapper.prototype = { + // nsISystemMessagesWrapper implementation. + wrapMessage: function wrapMessage(aMessage, aWindow) { + let peerImpl = new MozNFCPeerImpl(aWindow, aMessage.sessionToken); + let peer = aWindow.MozNFCPeer._create(aWindow, peerImpl); + + delete aMessage.sessionToken; + aMessage = Cu.cloneInto(aMessage, aWindow); + aMessage.peer = peer; + return aMessage; + }, + + classDescription: "NFCSendFileWrapper", + classID: Components.ID("{c5063a5c-8cb9-41d2-baf5-56062a2e30e9}"), + contractID: "@mozilla.org/dom/system-messages/wrapper/nfc-manager-send-file;1", + QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper]) +}; + this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozNFCTagImpl, - MozNFCPeerImpl, MozNFCImpl]); + MozNFCPeerImpl, MozNFCImpl, NFCSendFileWrapper]); diff --git a/dom/nfc/nsNfc.manifest b/dom/nfc/nsNfc.manifest index 9f81e9ae5277..6dbc24efe5c0 100644 --- a/dom/nfc/nsNfc.manifest +++ b/dom/nfc/nsNfc.manifest @@ -6,3 +6,6 @@ contract @mozilla.org/nfc/NFCTag;1 {4e1e2e90-3137-11e3-aa6e-0800200c9a66} component {c1b2bcf0-35eb-11e3-aa6e-0800200c9a66} nsNfc.js contract @mozilla.org/nfc/NFCPeer;1 {c1b2bcf0-35eb-11e3-aa6e-0800200c9a66} + +component {c5063a5c-8cb9-41d2-baf5-56062a2e30e9} nsNfc.js +contract @mozilla.org/dom/system-messages/wrapper/nfc-manager-send-file;1 {c5063a5c-8cb9-41d2-baf5-56062a2e30e9} From 7b3f9609047868e6e16b7d182e3794a9b3a3a13d Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Mon, 17 Nov 2014 18:00:14 +0800 Subject: [PATCH 070/121] Bug 1103730 - Create a nfc-manager-tech-discovered system message. r=dimi --- dom/nfc/nsNfc.js | 22 +++++++++++++++++++++- dom/nfc/nsNfc.manifest | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 42d0e145ae89..2887d8f89508 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -573,5 +573,25 @@ NFCSendFileWrapper.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper]) }; +function NFCTechDiscoveredWrapper() { +} +NFCTechDiscoveredWrapper.prototype = { + // nsISystemMessagesWrapper implementation. + wrapMessage: function wrapMessage(aMessage, aWindow) { + aMessage = Cu.cloneInto(aMessage, aWindow); + if (aMessage.techList.indexOf("P2P") != -1) { + let peerImpl = new MozNFCPeerImpl(aWindow, aMessage.sessionToken); + let peer = aWindow.MozNFCPeer._create(aWindow, peerImpl); + aMessage.peer = peer; + } + return aMessage; + }, + + classDescription: "NFCTechDiscoveredWrapper", + classID: Components.ID("{2e7f9285-3c72-4e1f-b985-141a00a23a75}"), + contractID: "@mozilla.org/dom/system-messages/wrapper/nfc-manager-tech-discovered;1", + QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper]) +}; + this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozNFCTagImpl, - MozNFCPeerImpl, MozNFCImpl, NFCSendFileWrapper]); + MozNFCPeerImpl, MozNFCImpl, NFCSendFileWrapper, NFCTechDiscoveredWrapper]); diff --git a/dom/nfc/nsNfc.manifest b/dom/nfc/nsNfc.manifest index 6dbc24efe5c0..f851b381c6c2 100644 --- a/dom/nfc/nsNfc.manifest +++ b/dom/nfc/nsNfc.manifest @@ -9,3 +9,6 @@ contract @mozilla.org/nfc/NFCPeer;1 {c1b2bcf0-35eb-11e3-aa6e-0800200c9a66} component {c5063a5c-8cb9-41d2-baf5-56062a2e30e9} nsNfc.js contract @mozilla.org/dom/system-messages/wrapper/nfc-manager-send-file;1 {c5063a5c-8cb9-41d2-baf5-56062a2e30e9} + +component {2e7f9285-3c72-4e1f-b985-141a00a23a75} nsNfc.js +contract @mozilla.org/dom/system-messages/wrapper/nfc-manager-tech-discovered;1 {2e7f9285-3c72-4e1f-b985-141a00a23a75} From 3cd61e837010d4eacdb5cef93da52ac6a4ea0fbb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:53:32 -0800 Subject: [PATCH 071/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/6d9439660ed7 Author: viorelaioia Desc: Merge pull request #26414 from chirarobert/bug_1096915 Bug 1096915 - Add a test to re-dial the last MO number by pressing the c... ======== https://hg.mozilla.org/integration/gaia-central/rev/d54c77a626be Author: Robert Chira Desc: Bug 1096915 - Add a test to re-dial the last MO number by pressing the call button twice --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c85706809d5d..f1ffbc9d04cf 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e02a9641ec6db339f592359be0e8974db2e9b7a0", + "revision": "6d9439660ed7362e6bbb4bccea92a88374b08e5a", "repo_path": "integration/gaia-central" } From 6e956856d1968f6924fa716a855f506ac7fd8a20 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 02:53:47 -0800 Subject: [PATCH 072/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index c32dad5f0410..e4818957d76a 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 90711dc619e2..3b87cc5bd22a 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0d5b315ef6be..99958cfd8c0f 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index dcb18068b101..7b6a4053552d 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 90711dc619e2..3b87cc5bd22a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index d9a830389b4f..48e430798e26 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d0cd18bd3f72..98b24f7cdc12 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 257cae118e91..91ab86d59e83 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 261a8f6e18a9..0cdb902b55e7 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index bb19e8cb1dbb..108173416b18 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index b2959b81060f..ca6ede545bcc 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From acb7b7286516198540786eb53ca1e155da621b86 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 04:36:53 -0800 Subject: [PATCH 073/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/b710813303f9 Author: Staś Małolepszy Desc: Merge pull request #25308 from stasm/1011519-hide-ar-fr-zhTW Bug 1011519 - Use pseudolocales in tests ======== https://hg.mozilla.org/integration/gaia-central/rev/1b25f92559fc Author: Staś Małolepszy Desc: Bug 1011519 - Use pseudolocales in tests. r=gandalf r=kgrandon r=arthurcc --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index f1ffbc9d04cf..8cc2f3c4046e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "6d9439660ed7362e6bbb4bccea92a88374b08e5a", + "revision": "b710813303f93261bc38283142d4c4ca9fe35b41", "repo_path": "integration/gaia-central" } From 2a0e86ac7b11afe15366a5c9b8fb4bf7051f83c6 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 04:41:58 -0800 Subject: [PATCH 074/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index e4818957d76a..13311706a180 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3b87cc5bd22a..24ed2284e161 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 99958cfd8c0f..734524e33d00 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 7b6a4053552d..d70bfd1e8837 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3b87cc5bd22a..24ed2284e161 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 48e430798e26..df65240a4f88 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 98b24f7cdc12..a611d2484a99 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 91ab86d59e83..ba101ec27c00 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 0cdb902b55e7..19fec298e25d 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 108173416b18..467a1d8e8a61 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index ca6ede545bcc..6503fa4e98dd 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 9cc36346252654c4e2952bd8284c281763221449 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 06:21:54 -0800 Subject: [PATCH 075/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e4822b34a357 Author: tamarahills Desc: Merge pull request #25909 from tamarahills/bugfix/1078448 Bug 1078448 - Modify call_screen_window.js reloadWindow to not leak Call... ======== https://hg.mozilla.org/integration/gaia-central/rev/a15b584927c9 Author: Tamara Hills Desc: Bug 1078448 - Modify call_screen_window.js reloadWindow to not leak CallScreen app instances. r=drs. ======== https://hg.mozilla.org/integration/gaia-central/rev/38844206ba88 Author: Florin Strugariu Desc: Merge pull request #26447 from davehunt/bug1074117-gallery Bug 1074117 - Use expected conditions and optimise element lookups in gallery app object ======== https://hg.mozilla.org/integration/gaia-central/rev/8ee272531ef9 Author: Dave Hunt Desc: Bug 1074117 - Use expected conditions and optimise element lookups in email app object. r=fstrugariu --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 8cc2f3c4046e..783a60dc8de2 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "b710813303f93261bc38283142d4c4ca9fe35b41", + "revision": "e4822b34a3571fabf58b7769230b12452fbba73d", "repo_path": "integration/gaia-central" } From 95affa11e3605b80084d82d21473eb02dd3c965f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 06:31:58 -0800 Subject: [PATCH 076/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 13311706a180..3a996417be3b 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 24ed2284e161..41fd961ea17c 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 734524e33d00..23a989b8a24d 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d70bfd1e8837..663b8a3c57c2 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 24ed2284e161..41fd961ea17c 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index df65240a4f88..0f5ed308edd8 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a611d2484a99..d24acc7bf606 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index ba101ec27c00..6fc8ed67418b 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 19fec298e25d..b36d358627a1 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 467a1d8e8a61..81a56a93e752 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 6503fa4e98dd..99cd19e293fe 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From ab1e560a8509bb2e4d86e72b8b79017763e7c383 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 06:51:56 -0800 Subject: [PATCH 077/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/95ec6dd29009 Author: Hubert Figuière Desc: Merge pull request #26454 from hfiguiere/tray-player-rtl Bug 1058727 - fix the notification tray playback control in RTL. r=gmarty ======== https://hg.mozilla.org/integration/gaia-central/rev/3f46dbfdc16a Author: Hubert Figuière Desc: Bug 1058727 - fix the notification tray playback control in RTL ======== https://hg.mozilla.org/integration/gaia-central/rev/568a6e7e5b77 Author: Wilson Page Desc: Merge pull request #26450 from wilsonpage/1104774 Bug 1104774 - [camera] Orientation broken after lock screen in preview-gallery ======== https://hg.mozilla.org/integration/gaia-central/rev/45576f05ca71 Author: Wilson Page Desc: Bug 1104774 - [camera] Orientation broken after lock screen in preview-gallery --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 783a60dc8de2..2be388940ee6 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e4822b34a3571fabf58b7769230b12452fbba73d", + "revision": "95ec6dd29009dfa578d2f622330fc0d6c8e9d21a", "repo_path": "integration/gaia-central" } From b5fb868ba2c7dfb54e8e0c356f32a586812c6aaa Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 07:02:02 -0800 Subject: [PATCH 078/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 3a996417be3b..f5d0353a425c 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 41fd961ea17c..eba1aae13ea0 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 23a989b8a24d..b2575d26d3a6 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 663b8a3c57c2..bae06ff45422 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 41fd961ea17c..eba1aae13ea0 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 0f5ed308edd8..eb2c8058c4e1 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d24acc7bf606..3ff84f29d264 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 6fc8ed67418b..23e6284519ab 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index b36d358627a1..3d02dd51b7e9 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 81a56a93e752..9caf07b03201 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 99cd19e293fe..869483a69e27 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 42be9850af5382c350b5242561f55ad8131a56de Mon Sep 17 00:00:00 2001 From: Henry Chang Date: Fri, 21 Nov 2014 15:46:04 +0800 Subject: [PATCH 079/121] Bug 1098192 - Remove unused mutex for ifc_* function calls. r=vchang --- dom/network/NetUtils.cpp | 11 ----------- dom/network/NetUtils.h | 4 ---- 2 files changed, 15 deletions(-) diff --git a/dom/network/NetUtils.cpp b/dom/network/NetUtils.cpp index 40ce44812f70..5bb215f50188 100644 --- a/dom/network/NetUtils.cpp +++ b/dom/network/NetUtils.cpp @@ -28,8 +28,6 @@ GetNetUtilsLibHandle() return sNetUtilsLib; } -mozilla::Mutex NetUtils::sIfcMutex("NetUtils::sIfcMutex"); - // static void* NetUtils::GetSharedLibrary() @@ -70,14 +68,12 @@ NetUtils::NetUtils() int32_t NetUtils::do_ifc_enable(const char *ifname) { USE_DLFUNC(ifc_enable) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_enable(ifname); } int32_t NetUtils::do_ifc_disable(const char *ifname) { USE_DLFUNC(ifc_disable) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_disable(ifname); } @@ -89,7 +85,6 @@ int32_t NetUtils::do_ifc_configure(const char *ifname, in_addr_t dns2) { USE_DLFUNC(ifc_configure) - mozilla::MutexAutoLock lock(sIfcMutex); int32_t ret = ifc_configure(ifname, address, prefixLength, gateway, dns1, dns2); return ret; } @@ -98,7 +93,6 @@ int32_t NetUtils::do_ifc_reset_connections(const char *ifname, const int32_t resetMask) { USE_DLFUNC(ifc_reset_connections) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_reset_connections(ifname, resetMask); } @@ -106,7 +100,6 @@ int32_t NetUtils::do_ifc_set_default_route(const char *ifname, in_addr_t gateway) { USE_DLFUNC(ifc_set_default_route) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_set_default_route(ifname, gateway); } @@ -116,7 +109,6 @@ int32_t NetUtils::do_ifc_add_route(const char *ifname, const char *gateway) { USE_DLFUNC(ifc_add_route) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_add_route(ifname, dst, prefixLength, gateway); } @@ -126,21 +118,18 @@ int32_t NetUtils::do_ifc_remove_route(const char *ifname, const char *gateway) { USE_DLFUNC(ifc_remove_route) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_remove_route(ifname, dst, prefixLength, gateway); } int32_t NetUtils::do_ifc_remove_host_routes(const char *ifname) { USE_DLFUNC(ifc_remove_host_routes) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_remove_host_routes(ifname); } int32_t NetUtils::do_ifc_remove_default_route(const char *ifname) { USE_DLFUNC(ifc_remove_default_route) - mozilla::MutexAutoLock lock(sIfcMutex); return ifc_remove_default_route(ifname); } diff --git a/dom/network/NetUtils.h b/dom/network/NetUtils.h index d032c36b6c06..6ae2894ab120 100644 --- a/dom/network/NetUtils.h +++ b/dom/network/NetUtils.h @@ -11,7 +11,6 @@ #define NetUtils_h #include "arpa/inet.h" -#include "mozilla/Mutex.h" // Copied from ifc.h #define RESET_IPV4_ADDRESSES 0x01 @@ -59,9 +58,6 @@ public: char* vendorinfo); static int32_t SdkVersion(); - -private: - static mozilla::Mutex sIfcMutex; }; // Defines a function type with the right arguments and return type. From 61d81bcfb098b4591b5859463b88409c40129037 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 25 Nov 2014 08:26:00 -0500 Subject: [PATCH 080/121] Bug 1100876 - Add showOnlyOnce to MozBehavior dict. r=mhenretty, r=smaug There are some notifications that we know we don't want to resend. For instance, Voicemail notifications are some, since everytime the network will be ready it will notify us of the status, so we don't have to resend it on reboot. We add a 'showOnlyOnce' key in the MozBehavior dict for this usecase. --- dom/notification/ChromeNotifications.js | 5 ++++ .../test_notification_resend.html | 29 +++++++++++++++++++ dom/webidl/Notification.webidl | 1 + 3 files changed, 35 insertions(+) diff --git a/dom/notification/ChromeNotifications.js b/dom/notification/ChromeNotifications.js index c24161f63e3f..cf7ee9e61557 100644 --- a/dom/notification/ChromeNotifications.js +++ b/dom/notification/ChromeNotifications.js @@ -54,6 +54,11 @@ ChromeNotifications.prototype = { } catch(e) { behavior = undefined; } + + if (behavior && behavior.showOnlyOnce === true) { + return; + } + appNotifier.showAppNotification( notification.icon, notification.title, diff --git a/dom/tests/mochitest/notification/test_notification_resend.html b/dom/tests/mochitest/notification/test_notification_resend.html index ebabf86944e6..8b40864af966 100644 --- a/dom/tests/mochitest/notification/test_notification_resend.html +++ b/dom/tests/mochitest/notification/test_notification_resend.html @@ -86,6 +86,35 @@ }); }, + function (done) { + info("Sending one non-resendable notification"); + var behavior = { + showOnlyOnce: true + }; + var notif = new Notification("title", { mozbehavior: behavior }); + ok(notif, "Notification object is valid"); + notifications.push(notif); + + var promise = Notification.get(); + promise.then(function (notifications) { + is(notifications.length, 1, "one notification has been sent"); + done(); + }); + }, + + function (done) { + info("Trying to resend non-resendable notification"); + var notif = notifications.pop(); + notif.onclose = function() { + done(); + }; + + navigator.mozChromeNotifications.mozResendAllNotifications(function(number) { + is(number, 0, "One notification not resent"); + notif.close(); + }); + }, + function (done) { info("Sending two notifications, closing one"); var notif1 = new Notification("title1"); diff --git a/dom/webidl/Notification.webidl b/dom/webidl/Notification.webidl index 167150d4fa15..3af977ce6f8f 100644 --- a/dom/webidl/Notification.webidl +++ b/dom/webidl/Notification.webidl @@ -72,6 +72,7 @@ dictionary GetNotificationOptions { dictionary NotificationBehavior { boolean noscreen = false; boolean noclear = false; + boolean showOnlyOnce = false; DOMString soundFile = ""; sequence vibrationPattern; }; From e5508741e042510c1c5c66b6e96f325f9604c878 Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Fri, 21 Nov 2014 09:34:00 -0500 Subject: [PATCH 081/121] Bug 1102986 - Update camera preview media stream with platform media stream expectations. r=roc --- dom/camera/CameraPreviewMediaStream.cpp | 21 +++++++++++++++++++++ dom/camera/CameraPreviewMediaStream.h | 2 ++ dom/camera/DOMCameraControl.cpp | 3 ++- dom/camera/DOMCameraControlListener.cpp | 1 + dom/camera/test/test_camera.html | 22 +++++++++++++++------- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/dom/camera/CameraPreviewMediaStream.cpp b/dom/camera/CameraPreviewMediaStream.cpp index a1d57c5a1f46..a426c277a5a9 100644 --- a/dom/camera/CameraPreviewMediaStream.cpp +++ b/dom/camera/CameraPreviewMediaStream.cpp @@ -19,6 +19,8 @@ using namespace mozilla::dom; namespace mozilla { +static const TrackID TRACK_VIDEO = 2; + void FakeMediaStreamGraph::DispatchToMainThreadAfterStreamStateUpdate(already_AddRefed aRunnable) { @@ -32,6 +34,7 @@ CameraPreviewMediaStream::CameraPreviewMediaStream(DOMMediaStream* aWrapper) , mInvalidatePending(0) , mDiscardedFrames(0) , mRateLimit(false) + , mTrackCreated(false) { SetGraphImpl(MediaStreamGraph::GetInstance()); mFakeMediaStreamGraph = new FakeMediaStreamGraph(); @@ -111,6 +114,24 @@ CameraPreviewMediaStream::RemoveListener(MediaStreamListener* aListener) listener->NotifyEvent(mFakeMediaStreamGraph, MediaStreamListener::EVENT_REMOVED); } +void +CameraPreviewMediaStream::OnPreviewStateChange(bool aActive) +{ + if (aActive) { + MutexAutoLock lock(mMutex); + if (!mTrackCreated) { + mTrackCreated = true; + VideoSegment tmpSegment; + for (uint32_t j = 0; j < mListeners.Length(); ++j) { + MediaStreamListener* l = mListeners[j]; + l->NotifyQueuedTrackChanges(mFakeMediaStreamGraph, TRACK_VIDEO, 0, + MediaStreamListener::TRACK_EVENT_CREATED, + tmpSegment); + } + } + } +} + void CameraPreviewMediaStream::Destroy() { diff --git a/dom/camera/CameraPreviewMediaStream.h b/dom/camera/CameraPreviewMediaStream.h index 84536c6f6af6..16077f4b07a6 100644 --- a/dom/camera/CameraPreviewMediaStream.h +++ b/dom/camera/CameraPreviewMediaStream.h @@ -51,6 +51,7 @@ public: virtual void AddListener(MediaStreamListener* aListener) MOZ_OVERRIDE; virtual void RemoveListener(MediaStreamListener* aListener) MOZ_OVERRIDE; virtual void Destroy(); + void OnPreviewStateChange(bool aActive); void Invalidate(); @@ -67,6 +68,7 @@ protected: int32_t mInvalidatePending; uint32_t mDiscardedFrames; bool mRateLimit; + bool mTrackCreated; nsRefPtr mFakeMediaStreamGraph; }; diff --git a/dom/camera/DOMCameraControl.cpp b/dom/camera/DOMCameraControl.cpp index e13c3c9970bf..e639fcbed3da 100644 --- a/dom/camera/DOMCameraControl.cpp +++ b/dom/camera/DOMCameraControl.cpp @@ -291,7 +291,8 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, mCurrentConfiguration = initialConfig.forget(); // Attach our DOM-facing media stream to our viewfinder stream. - mStream = mInput; + SetHintContents(HINT_CONTENTS_VIDEO); + InitStreamCommon(mInput); MOZ_ASSERT(mWindow, "Shouldn't be created with a null window!"); if (mWindow->GetExtantDoc()) { CombineWithPrincipal(mWindow->GetExtantDoc()->NodePrincipal()); diff --git a/dom/camera/DOMCameraControlListener.cpp b/dom/camera/DOMCameraControlListener.cpp index 0c8396156d48..e575cb563975 100644 --- a/dom/camera/DOMCameraControlListener.cpp +++ b/dom/camera/DOMCameraControlListener.cpp @@ -140,6 +140,7 @@ DOMCameraControlListener::OnPreviewStateChange(PreviewState aState) MOZ_ASSERT_UNREACHABLE("Invalid preview state"); return; } + mStream->OnPreviewStateChange(aState == kPreviewStarted); NS_DispatchToMainThread(new Callback(mDOMCameraControl, aState)); } diff --git a/dom/camera/test/test_camera.html b/dom/camera/test/test_camera.html index 30394e382f58..208fcfac87cc 100644 --- a/dom/camera/test/test_camera.html +++ b/dom/camera/test/test_camera.html @@ -109,18 +109,26 @@ var Camera = { var blob = e.data; var img = new Image(); var test = this._currentTest; + var onPreviewStateChange = function(e) { + if (e.newState === 'started') { + ok(true, "viewfinder is ready and playing after resume"); + Camera.cameraObj.removeEventListener('previewstatechange', onPreviewStateChange); + Camera._testsCompleted++; + if(Camera._testsCompleted == Camera._tests.length) { + ok(true, "test finishing"); + SimpleTest.finish(); + } else { + Camera.runTests(); + } + } + } + Camera.cameraObj.addEventListener('previewstatechange', onPreviewStateChange); img.onload = function Imgsize() { ok(this.width == test.pictureSize.width, "The image taken has the width " + this.width + " pictureSize width = " + test.pictureSize.width); ok(this.height == test.pictureSize.height, "The image taken has the height " + this.height + " picturesize height = " + test.pictureSize.height); - Camera._testsCompleted++; - if(Camera._testsCompleted == Camera._tests.length) { - ok(true, "test finishing"); - SimpleTest.finish(); - } else { - Camera.runTests(); - } + Camera.cameraObj.resumePreview(); } ok(blob.size > 100 , "Blob Size Gathered = " + blob.size); ok("image/" + test.fileFormat == blob.type, "Blob Type = " + blob.type); From bf601ba1e5dd28c09da579dffca2e9c19688854c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 07:38:26 -0800 Subject: [PATCH 082/121] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index eba1aae13ea0..8a0bd0dc8757 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -23,7 +23,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index eba1aae13ea0..8a0bd0dc8757 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -23,7 +23,7 @@ - + From 76d42f33f52ee3b4b0b3323fbcaa3c396495208d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 09:11:55 -0800 Subject: [PATCH 083/121] Bumping gaia.json for 8 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e68d2771a8d5 Author: Tzu-Lin Huang Desc: Merge pull request #26436 from dwi2/bug1103339 Bug 1103339 - System app should not process keydown/keyup event target t... ======== https://hg.mozilla.org/integration/gaia-central/rev/e73305953dad Author: Tzu-Lin Huang Desc: Bug 1103339 - System app should not process keydown/keyup event target to embedded iframe ======== https://hg.mozilla.org/integration/gaia-central/rev/25343f6b5ce7 Author: Ryan VanderMeulen Desc: Merge pull request #26244 from mancas/bug1098611 Bug 1098611 - [FTU] UI does not update when switching networks in FTU ======== https://hg.mozilla.org/integration/gaia-central/rev/353b8bfebe28 Author: Manuel Casas Desc: Bug 1098611 - [FTU] UI does not update when switching networks in FTU ======== https://hg.mozilla.org/integration/gaia-central/rev/638251bd179a Author: Ryan VanderMeulen Desc: Merge pull request #26324 from weideng/bug1098188 Bug 1098188 - Keyboard settings can't be pre-localized when handwriting layout included. r=stas ======== https://hg.mozilla.org/integration/gaia-central/rev/ec9d4716e825 Author: wdeng Desc: Bug 1098188 - Keyboard settings can't be pre-localized when handwriting layout included ======== https://hg.mozilla.org/integration/gaia-central/rev/6b8a77262b3c Author: Ryan VanderMeulen Desc: Merge pull request #26474 from xeonchen/bug-1096236 Bug 1096236 - Remove "alternateLayoutOverwrite" in Arabic layout definition ======== https://hg.mozilla.org/integration/gaia-central/rev/8e6e5753330f Author: Liang-Heng Chen Desc: Bug 1096236 - Remove "alternateLayoutOverwrite" in Arabic layout definition. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2be388940ee6..1d425d99796c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "95ec6dd29009dfa578d2f622330fc0d6c8e9d21a", + "revision": "e68d2771a8d5d992a7c3c2d35ec17d8cccf2df82", "repo_path": "integration/gaia-central" } From 1be59bd1ec9684fb088c772be7822034bcd2a34c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 09:13:28 -0800 Subject: [PATCH 084/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 4 ++-- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 4 ++-- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index f5d0353a425c..9e471dd7d740 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8a0bd0dc8757..a07c298a3765 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,11 +19,11 @@ - + - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b2575d26d3a6..a054e8e62368 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index bae06ff45422..c15f092abc87 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8a0bd0dc8757..a07c298a3765 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,11 +19,11 @@ - + - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index eb2c8058c4e1..c4b22e795b86 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 3ff84f29d264..8a9578ae97e5 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 23e6284519ab..919d945e46e4 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 3d02dd51b7e9..901779af4791 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 9caf07b03201..1887adf3dc2d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 869483a69e27..0a920cc1d261 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 9ad226a883746f3a3db2985ed87febf789773924 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 26 Nov 2014 12:40:55 -0500 Subject: [PATCH 085/121] Bug 1105295 - Stop using scrollinfo layers when event regions are enabled. r=botond --- gfx/layers/apz/src/APZCTreeManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index b6df083b04d5..b367ac9cc1d6 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -246,6 +246,9 @@ APZCTreeManager::PrepareAPZCForLayer(const LayerMetricsWrapper& aLayer, if (!aMetrics.IsScrollable()) { return nullptr; } + if (gfxPrefs::LayoutEventRegionsEnabled() && aLayer.IsScrollInfoLayer()) { + return nullptr; + } const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aLayersId); if (!(state && state->mController.get())) { From f0cd00242208cb5cb05bd0eb053891c5028b64f6 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 26 Nov 2014 12:41:06 -0500 Subject: [PATCH 086/121] Bug 1085404 - When interacting with a fast-moving APZC, don't send the events to content. r=botond --- gfx/layers/apz/src/APZCTreeManager.h | 9 +++++---- gfx/layers/apz/src/InputBlockState.cpp | 19 +++++++++++++------ gfx/layers/apz/src/InputBlockState.h | 20 ++++++++++++++------ gfx/layers/apz/src/InputQueue.cpp | 9 +++++++-- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index 2db38461ef0f..d40252ce85ca 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -143,10 +143,11 @@ public: * The following values may be returned by this function: * nsEventStatus_eConsumeNoDefault is returned to indicate the * caller should discard the event with extreme prejudice. - * Currently this is only returned if the APZ determines that - * something is in overscroll and the event should be ignored entirely. - * There may be other scenarios where this return code might be used in - * the future. + * Currently this is only returned if the APZ determines that something is + * in overscroll and the event should be ignored entirely, or if the input + * event is part of a extended gesture like flywheel scrolling, and gets + * consumed within the APZ code. There may be other scenarios where this + * return code might be used in the future. * nsEventStatus_eIgnore is returned to indicate that the APZ code didn't * use this event. This might be because it was directed at a point on * the screen where there was no APZ, or because the thing the user was diff --git a/gfx/layers/apz/src/InputBlockState.cpp b/gfx/layers/apz/src/InputBlockState.cpp index a0d7951407cf..c8501883102c 100644 --- a/gfx/layers/apz/src/InputBlockState.cpp +++ b/gfx/layers/apz/src/InputBlockState.cpp @@ -84,7 +84,7 @@ TouchBlockState::TouchBlockState(const nsRefPtr& aTarget , mPreventDefault(false) , mContentResponded(false) , mContentResponseTimerExpired(false) - , mSingleTapDisallowed(false) + , mDuringFastMotion(false) , mSingleTapOccurred(false) { TBS_LOG("Creating %p\n", this); @@ -164,17 +164,24 @@ TouchBlockState::IsDefaultPrevented() const } void -TouchBlockState::DisallowSingleTap() +TouchBlockState::SetDuringFastMotion() { - TBS_LOG("%p disallowing single-tap\n", this); - mSingleTapDisallowed = true; + TBS_LOG("%p setting fast-motion flag\n", this); + mDuringFastMotion = true; +} + +bool +TouchBlockState::IsDuringFastMotion() const +{ + return mDuringFastMotion; } bool TouchBlockState::SetSingleTapOccurred() { - TBS_LOG("%p attempting to set single-tap occurred; disallowed=%d\n", this, mSingleTapDisallowed); - if (!mSingleTapDisallowed) { + TBS_LOG("%p attempting to set single-tap occurred; disallowed=%d\n", + this, mDuringFastMotion); + if (!mDuringFastMotion) { mSingleTapOccurred = true; return true; } diff --git a/gfx/layers/apz/src/InputBlockState.h b/gfx/layers/apz/src/InputBlockState.h index 62014e4364e5..ea70371ad1d7 100644 --- a/gfx/layers/apz/src/InputBlockState.h +++ b/gfx/layers/apz/src/InputBlockState.h @@ -116,16 +116,24 @@ public: bool IsDefaultPrevented() const; /** - * Set a flag that disables setting the single-tap flag on this block. + * Sets a flag that indicates this input block occurred while the APZ was + * in a state of fast motion. This affects gestures that may be produced + * from input events in this block. */ - void DisallowSingleTap(); + void SetDuringFastMotion(); /** - * Set a flag that indicates that this touch block triggered a single tap event. - * @return true iff DisallowSingleTap was not previously called. + * @return true iff SetDuringFastMotion was called on this block. + */ + bool IsDuringFastMotion() const; + /** + * Set the single-tap-occurred flag that indicates that this touch block + * triggered a single tap event. + * @return true if the flag was set. This may not happen if, for example, + * SetDuringFastMotion was previously called. */ bool SetSingleTapOccurred(); /** - * @return true iff SetSingleTapOccurred was previously called on this block. + * @return true iff the single-tap-occurred flag is set on this block. */ bool SingleTapOccurred() const; @@ -171,7 +179,7 @@ private: bool mPreventDefault; bool mContentResponded; bool mContentResponseTimerExpired; - bool mSingleTapDisallowed; + bool mDuringFastMotion; bool mSingleTapOccurred; nsTArray mEvents; }; diff --git a/gfx/layers/apz/src/InputQueue.cpp b/gfx/layers/apz/src/InputQueue.cpp index cfd6f5724dc9..bc53115ded4b 100644 --- a/gfx/layers/apz/src/InputQueue.cpp +++ b/gfx/layers/apz/src/InputQueue.cpp @@ -59,7 +59,7 @@ InputQueue::ReceiveInputEvent(const nsRefPtr& aTarget, if (block->GetOverscrollHandoffChain()->HasFastMovingApzc()) { // If we're already in a fast fling, then we want the touch event to stop the fling // and to disallow the touch event from being used as part of a fling. - block->DisallowSingleTap(); + block->SetDuringFastMotion(); } block->GetOverscrollHandoffChain()->CancelAnimations(); } @@ -68,6 +68,9 @@ InputQueue::ReceiveInputEvent(const nsRefPtr& aTarget, if (!gfxPrefs::LayoutEventRegionsEnabled()) { waitForMainThread |= aTarget->NeedToWaitForContent(); } + if (block->IsDuringFastMotion()) { + waitForMainThread = false; + } if (waitForMainThread) { // We either don't know for sure if aTarget is the right APZC, or we may // need to wait to give content the opportunity to prevent-default the @@ -106,7 +109,9 @@ InputQueue::ReceiveInputEvent(const nsRefPtr& aTarget, // XXX calling ArePointerEventsConsumable on |target| may be wrong here if // the target isn't confirmed and the real target turns out to be something // else. For now assume this is rare enough that it's not an issue. - if (target && target->ArePointerEventsConsumable(block, aEvent.AsMultiTouchInput().mTouches.Length())) { + if (block->IsDuringFastMotion()) { + result = nsEventStatus_eConsumeNoDefault; + } else if (target && target->ArePointerEventsConsumable(block, aEvent.AsMultiTouchInput().mTouches.Length())) { result = nsEventStatus_eConsumeDoDefault; } From 4bc4b52cd1a4051ecbb65feb5ac3d89caa34424f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 10:46:59 -0800 Subject: [PATCH 087/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/26fad79263f9 Author: Kevin Grandon Desc: Merge pull request #26459 from KevinGrandon/bug_1101158_use_tagged_template Bug 1101158 - Use shared tagged template library for escaping card content ======== https://hg.mozilla.org/integration/gaia-central/rev/3bbe686afb35 Author: Kevin Grandon Desc: Bug 1101158 - Use shared tagged template library for escaping card content r=aus r=freddyb ======== https://hg.mozilla.org/integration/gaia-central/rev/de0c1f0eb0f8 Author: Francisco Jordano Desc: Merge pull request #26238 from arcturus/bug-1064502 Bug 1064502 - [RTL] Contacts List - Letters should not overlap contact names and faces. r=sergi ======== https://hg.mozilla.org/integration/gaia-central/rev/a67ddd34d779 Author: Francisco Jordano Desc: Bug 1064502 - [RTL] Contacts List - Letters should not overlap contact names and faces. r=sergi --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1d425d99796c..a0e5bbbe7fbc 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "e68d2771a8d5d992a7c3c2d35ec17d8cccf2df82", + "revision": "26fad79263f99da4a94cec6a2c49a64bd4d8f62c", "repo_path": "integration/gaia-central" } From c46c81e0f702ac3d8316d73537126446682110f4 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 10:56:35 -0800 Subject: [PATCH 088/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 9e471dd7d740..af44fc4db3b6 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a07c298a3765..39e581fe00c3 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index a054e8e62368..837bc711b8fc 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index c15f092abc87..216216c50147 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index a07c298a3765..39e581fe00c3 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index c4b22e795b86..b925b65e66da 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 8a9578ae97e5..d5fdc498d724 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 919d945e46e4..13d41a2abe3d 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 901779af4791..3027e855754a 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 1887adf3dc2d..46163f5c69e0 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0a920cc1d261..9589eae689c2 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From a2bee51132246b1ef2a6b02b4b926f02dd45aed8 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 26 Nov 2014 13:58:15 -0500 Subject: [PATCH 089/121] Bug 1105016 - Update tld to pld in debug logging. r=mstange DONTBUILD because NPOTB --- layout/base/FrameLayerBuilder.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 4e4140bc84b8..81e31754eb01 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -275,9 +275,9 @@ public: */ nsAutoCString mLog; - #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \ - tld->mLog.AppendPrintf("\t\t\t\t"); \ - tld->mLog.AppendPrintf(__VA_ARGS__); + #define FLB_LOG_PAINTED_LAYER_DECISION(pld, ...) \ + pld->mLog.AppendPrintf("\t\t\t\t"); \ + pld->mLog.AppendPrintf(__VA_ARGS__); #else #define FLB_LOG_PAINTED_LAYER_DECISION(...) #endif @@ -309,7 +309,7 @@ public: */ void AccumulateEventRegions(nsDisplayLayerEventRegions* aEventRegions) { - FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating event regions %p against tld=%p\n", aEventRegions, this); + FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating event regions %p against pld=%p\n", aEventRegions, this); mHitRegion.Or(mHitRegion, aEventRegions->HitRegion()); mMaybeHitRegion.Or(mMaybeHitRegion, aEventRegions->MaybeHitRegion()); @@ -2106,7 +2106,7 @@ ContainerState::PopPaintedLayerData() nsRefPtr layer; nsRefPtr imageContainer = data->CanOptimizeImageLayer(mBuilder); - FLB_LOG_PAINTED_LAYER_DECISION(data, "Selecting layer for tld=%p\n", data); + FLB_LOG_PAINTED_LAYER_DECISION(data, "Selecting layer for pld=%p\n", data); FLB_LOG_PAINTED_LAYER_DECISION(data, " Solid=%i, hasImage=%i, canOptimizeAwayPaintedLayer=%i\n", data->mIsSolidColorInVisibleRegion, !!imageContainer, CanOptimizeAwayPaintedLayer(data, mLayerBuilder)); @@ -2347,7 +2347,7 @@ PaintedLayerData::Accumulate(ContainerState* aState, const nsIntRect& aDrawRect, const DisplayItemClip& aClip) { - FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this); + FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against pld=%p\n", aItem->Name(), aItem, aItem->Frame(), this); bool snap; nsRect itemBounds = aItem->GetBounds(aState->mBuilder, &snap); From 9b02c5402dab38f3a30ff33b149ed70d1ff5364c Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 20 Nov 2014 10:48:00 -0500 Subject: [PATCH 090/121] Bug 1097814 - Fix fake hardware buttons in mulet. r=paul, r=vingtetun --- b2g/components/SystemAppProxy.jsm | 8 ++++- .../responsivedesign/responsivedesign.jsm | 32 +++++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/b2g/components/SystemAppProxy.jsm b/b2g/components/SystemAppProxy.jsm index 064b0af595f2..eec500de31a7 100644 --- a/b2g/components/SystemAppProxy.jsm +++ b/b2g/components/SystemAppProxy.jsm @@ -89,10 +89,16 @@ let SystemAppProxy = { }, // Now deprecated, use sendCustomEvent with a custom event name - dispatchEvent: function systemApp_sendChromeEvent(details, target) { + dispatchEvent: function systemApp_dispatchEvent(details, target) { return this._sendCustomEvent('mozChromeEvent', details, false, target); }, + dispatchKeyboardEvent: function systemApp_dispatchKeyboardEvent(type, details) { + let content = this._frame ? this._frame.contentWindow : null; + let e = new content.KeyboardEvent(type, details); + content.dispatchEvent(e); + }, + // Listen for dom events on the system app addEventListener: function systemApp_addEventListener() { let content = this._frame ? this._frame.contentWindow : null; diff --git a/browser/devtools/responsivedesign/responsivedesign.jsm b/browser/devtools/responsivedesign/responsivedesign.jsm index 4feb039976d6..9a1d506ca7b1 100644 --- a/browser/devtools/responsivedesign/responsivedesign.jsm +++ b/browser/devtools/responsivedesign/responsivedesign.jsm @@ -482,11 +482,11 @@ ResponsiveUI.prototype = { sleepButton.className = "devtools-responsiveui-sleep-button"; sleepButton.setAttribute("top", 0); sleepButton.setAttribute("right", 0); - sleepButton.addEventListener("mousedown", function() { - SystemAppProxy.dispatchEvent({type: "sleep-button-press"}); + sleepButton.addEventListener("mousedown", () => { + SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "Power"}); }); - sleepButton.addEventListener("mouseup", function() { - SystemAppProxy.dispatchEvent({type: "sleep-button-release"}); + sleepButton.addEventListener("mouseup", () => { + SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "Power"}); }); this.stack.appendChild(sleepButton); @@ -497,20 +497,20 @@ ResponsiveUI.prototype = { let volumeUp = this.chromeDoc.createElement("button"); volumeUp.className = "devtools-responsiveui-volume-up-button"; - volumeUp.addEventListener("mousedown", function() { - SystemAppProxy.dispatchEvent({type: "volume-up-button-press"}); + volumeUp.addEventListener("mousedown", () => { + SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "VolumeUp"}); }); - volumeUp.addEventListener("mouseup", function() { - SystemAppProxy.dispatchEvent({type: "volume-up-button-release"}); + volumeUp.addEventListener("mouseup", () => { + SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "VolumeUp"}); }); let volumeDown = this.chromeDoc.createElement("button"); volumeDown.className = "devtools-responsiveui-volume-down-button"; - volumeDown.addEventListener("mousedown", function() { - SystemAppProxy.dispatchEvent({type: "volume-down-button-press"}); + volumeDown.addEventListener("mousedown", () => { + SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "VolumeDown"}); }); - volumeDown.addEventListener("mouseup", function() { - SystemAppProxy.dispatchEvent({type: "volume-down-button-release"}); + volumeDown.addEventListener("mouseup", () => { + SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "VolumeDown"}); }); volumeButtons.appendChild(volumeUp); @@ -524,11 +524,11 @@ ResponsiveUI.prototype = { let homeButton = this.chromeDoc.createElement("toolbarbutton"); homeButton.className = "devtools-responsiveui-toolbarbutton devtools-responsiveui-home-button"; - homeButton.addEventListener("mousedown", function() { - SystemAppProxy.dispatchEvent({type: "home-button-press"}); + homeButton.addEventListener("mousedown", () => { + SystemAppProxy.dispatchKeyboardEvent("keydown", {key: "Home"}); }); - homeButton.addEventListener("mouseup", function() { - SystemAppProxy.dispatchEvent({type: "home-button-release"}); + homeButton.addEventListener("mouseup", () => { + SystemAppProxy.dispatchKeyboardEvent("keyup", {key: "Home"}); }); bottomToolbar.appendChild(homeButton); this.bottomToolbar = bottomToolbar; From dc6c3467451b2cbe60835883af7bd6a008128157 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 23:11:58 -0800 Subject: [PATCH 091/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/26b3f842b757 Author: Alive.Kuo Desc: Merge pull request #26394 from alivedise/bugzilla/1097675/ignore-hidden-attention-window Bug 1097675 - Ignore hidden window when updating attention indicator, r=etienne ======== https://hg.mozilla.org/integration/gaia-central/rev/dc39f37e9129 Author: Alive Kuo Desc: Bug 1097675 - Ignore hidden window when updating attention indicator ======== https://hg.mozilla.org/integration/gaia-central/rev/33128e5b7819 Author: Alive.Kuo Desc: Merge pull request #25989 from alivedise/bugzilla/1096133/home-event-dispatcher Bug 1096133 - Get rid of stopImmediatePropagation, r=etienne ======== https://hg.mozilla.org/integration/gaia-central/rev/34ae42f06aa2 Author: Alive Kuo Desc: Bug 1096133 - Get rid of stopImmediatePropagation of hierarchy events --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 992ec938593a..745f7e9243ab 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "0ae677ae34c305d2b26fc1f2f74de10895a562ba", + "revision": "26b3f842b7570567c06640f7d72804efd2e33afc", "repo_path": "integration/gaia-central" } From 81f4fc8f9bf541a5657e4693fcc32ab20fd75725 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 23:17:13 -0800 Subject: [PATCH 092/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index c247267be5e0..0307d1d157fc 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 0bc9f5c9f02b..9e5b2061c7f9 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 7d078791546a..73b669313ece 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index b22dd227e79b..7240afa1bc36 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 0bc9f5c9f02b..9e5b2061c7f9 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index c51dd64e84ad..3792d832b7a4 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index e65d4cc2ebc6..6a3595a5a033 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 154e964775af..5ff03dcba34b 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 60fae030d421..f342e6d6e027 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 9dc3f322254b..bf101f9b0fcb 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 631403e13604..0332480fc5df 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 4a7c120c73946a4ca46ecd5456dfef4dd258b25d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 23:41:59 -0800 Subject: [PATCH 093/121] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/b3f1a9a22f1e Author: Rudy Lu Desc: Merge pull request #26343 from rabbihossain/master Bug 1089604 - Implement en-GB keyboard layout. r=rudylu ======== https://hg.mozilla.org/integration/gaia-central/rev/718f31b0fc44 Author: rabbihossain Desc: Bug 1089604 - Implement en-GB keyboard layout ======== https://hg.mozilla.org/integration/gaia-central/rev/93af6a8eff74 Author: Tzu-Lin Huang Desc: Merge pull request #26401 from dwi2/bug1094094 Bug 1094094 - [Stingray] Implement navigation and contextmenu of Apps Deck, r=rexboy7 ======== https://hg.mozilla.org/integration/gaia-central/rev/749f7e0b66dd Author: Tzu-Lin Huang Desc: Bug 1094094 - [Stingray] Implement navigation and contextmenu of Apps Deck --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 745f7e9243ab..bda7b6f9edb4 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "26b3f842b7570567c06640f7d72804efd2e33afc", + "revision": "b3f1a9a22f1e71caa6b4edca6892ea75e3c0bf7f", "repo_path": "integration/gaia-central" } From 171ac8241731f2790cbae68fd1932faa0bfa2725 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 25 Nov 2014 23:47:09 -0800 Subject: [PATCH 094/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 0307d1d157fc..e8dc5586feb1 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9e5b2061c7f9..ae0785a5533a 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 73b669313ece..b264d20680f8 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 7240afa1bc36..3f606397d394 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9e5b2061c7f9..ae0785a5533a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 3792d832b7a4..f8c7f841d4c9 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 6a3595a5a033..402abe3847dc 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 5ff03dcba34b..8c7cee694e8e 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index f342e6d6e027..da8027388930 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index bf101f9b0fcb..56107f03f299 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0332480fc5df..0c901f52d5fc 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From dedfda20f0ddb537cc17f5eda9eb84343c2e6be0 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 00:11:55 -0800 Subject: [PATCH 095/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/4ea81d5b40c9 Author: Carsten Book Desc: Merge pull request #25331 from kumarrishav/Bug-1054635 Bug 1054635 - Context menu/long tap on container area in Composer panel causes javascript error. r=julienw ======== https://hg.mozilla.org/integration/gaia-central/rev/858fe8997401 Author: kumarrishav Desc: Bug 1054635 - Context menu/long tap on container area in Composer panel causes javascript error --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index bda7b6f9edb4..3c113da6aff1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "b3f1a9a22f1e71caa6b4edca6892ea75e3c0bf7f", + "revision": "4ea81d5b40c9ef8f13938e0658d22ae51029bae1", "repo_path": "integration/gaia-central" } From 6e98df967a8396c9babb061fb9f86a8223c1ebbb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 00:22:01 -0800 Subject: [PATCH 096/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index e8dc5586feb1..79a5f8c8f640 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index ae0785a5533a..5e90b5a54eb7 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b264d20680f8..44078f621a7d 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 3f606397d394..d6b70a43c97b 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index ae0785a5533a..5e90b5a54eb7 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index f8c7f841d4c9..b73b74c566af 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 402abe3847dc..5e4f244ff6cc 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 8c7cee694e8e..1ae8b0b24950 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index da8027388930..8cdd244caf55 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 56107f03f299..8c87eb92e8b1 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0c901f52d5fc..a04fd25de5b0 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From d6bdc3bf24d9642cfdcac9ed5e2bb4af0d49d3a2 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 00:41:57 -0800 Subject: [PATCH 097/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/769491b13858 Author: Chris Lord Desc: Merge pull request #26415 from Cwiiis/bug1098480-landscape-system-update Bug 1098480 - Fix system update splash in landscape. r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/59a1496e986d Author: Chris Lord Desc: Bug 1098480 - Fix system update splash in landscape. r=alive --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 3c113da6aff1..326f3c0c7420 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "4ea81d5b40c9ef8f13938e0658d22ae51029bae1", + "revision": "769491b138582de92f5636413928de13268e1a63", "repo_path": "integration/gaia-central" } From d1357bcbc6fed7b23b42fd794706e1a59fdc84ce Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 00:52:01 -0800 Subject: [PATCH 098/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 79a5f8c8f640..5ec71dbee8d4 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 5e90b5a54eb7..9bb555dff0fb 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 44078f621a7d..7a322faf010e 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d6b70a43c97b..ef8a12d8ffc4 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 5e90b5a54eb7..9bb555dff0fb 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b73b74c566af..2f7b970251cd 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5e4f244ff6cc..a65bd7b1011b 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 1ae8b0b24950..b113268a20a6 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 8cdd244caf55..e7f051461288 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 8c87eb92e8b1..093bebf99407 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a04fd25de5b0..12ecd390d69d 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From c6d9ee28b8a69fb04a35abbb3cd51817f6fa4d2a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:21:56 -0800 Subject: [PATCH 099/121] Bumping gaia.json for 6 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/b9eae46e87a2 Author: autolander Desc: Bug 1105078 - merge pull request #26462 from KevinGrandon:bug_1105078_remove_crash_reporter_strings to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/f39cb006488e Author: Kevin Grandon Desc: Bug 1105078 - Remove strings from index.html for crash reporter dialog r=kgrandon ======== https://hg.mozilla.org/integration/gaia-central/rev/de3bb419776d Author: autolander Desc: Bug 1105077 - merge pull request #26463 from KevinGrandon:bug_1105077_remove_strings to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/7b64655e4f2b Author: Kevin Grandon Desc: Bug 1105077 - Remove strings from index.html for rocketbar and utility tray ======== https://hg.mozilla.org/integration/gaia-central/rev/2db31c7b808c Author: autolander Desc: Bug 1105079 - merge pull request #26461 from KevinGrandon:bug_1105079_remove_crash_info_strings to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/d7959409b127 Author: Kevin Grandon Desc: Bug 1105079 - Remove strings from index.html for crash info page --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index a0e5bbbe7fbc..fb32c713e039 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "26fad79263f99da4a94cec6a2c49a64bd4d8f62c", + "revision": "b9eae46e87a2364ee1d7c6eb5d2467a69c3aadfa", "repo_path": "integration/gaia-central" } From da36a66194fbd374c584ab52eee2165a14538478 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:27:00 -0800 Subject: [PATCH 100/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index af44fc4db3b6..4431470e14f0 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 39e581fe00c3..b4cb173cc4b2 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 837bc711b8fc..23fb8090d1d1 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 216216c50147..4b99b9de384f 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 39e581fe00c3..b4cb173cc4b2 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b925b65e66da..3e33a49defde 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d5fdc498d724..f041c545be24 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 13d41a2abe3d..ec3ea086406c 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 3027e855754a..64db49a69c1f 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 46163f5c69e0..7cdd4f27293d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 9589eae689c2..755f83dae253 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From daffb529593615c8751e92390f32343b5caea22a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:36:55 -0800 Subject: [PATCH 101/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/f3637cd27193 Author: Michael Henretty Desc: Merge pull request #26479 from albertopq/1104919-rocketbar-maximize Bug 1104919 - Recalculate statusbar when rocketbar expanded r=mhenretty ======== https://hg.mozilla.org/integration/gaia-central/rev/67fb49478556 Author: albertopq Desc: Bug 1104919 - Recalculate statusbar when rocketbar expanded --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index fb32c713e039..c5ee647c448e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "b9eae46e87a2364ee1d7c6eb5d2467a69c3aadfa", + "revision": "f3637cd27193e8eca7796781ef2f3a4fbcbe06a1", "repo_path": "integration/gaia-central" } From e7d9a07c852c26b3553f89282cadbe56f41c16a8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:41:58 -0800 Subject: [PATCH 102/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 4431470e14f0..a21b3d64e8b2 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index b4cb173cc4b2..8e7fe4c28b73 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 23fb8090d1d1..5dc287bdda09 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 4b99b9de384f..d6ca55aaf8d2 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index b4cb173cc4b2..8e7fe4c28b73 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 3e33a49defde..5a92a91f052b 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f041c545be24..f844a37677e1 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index ec3ea086406c..b9b7721d97d3 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 64db49a69c1f..c00f5ade0081 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 7cdd4f27293d..a421162d0374 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 755f83dae253..730cc9a8e51b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From e43b3f25eff5f52a54400a8bc9953f7871a44809 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 26 Nov 2014 19:45:48 +0000 Subject: [PATCH 103/121] Bug 1090364 - Add fading edge to tab strip (r=mcomella) --- .../android/base/resources/values/dimens.xml | 1 + mobile/android/base/tabs/TabStripView.java | 62 +++++++++++++++++-- 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml index 4ebe0ef061d1..73d0821ef8e2 100644 --- a/mobile/android/base/resources/values/dimens.xml +++ b/mobile/android/base/resources/values/dimens.xml @@ -26,6 +26,7 @@ 208dp -28dp 16dp + 15dp 60dp 34dp diff --git a/mobile/android/base/tabs/TabStripView.java b/mobile/android/base/tabs/TabStripView.java index fdd826fcda88..c6a1837632f4 100644 --- a/mobile/android/base/tabs/TabStripView.java +++ b/mobile/android/base/tabs/TabStripView.java @@ -8,13 +8,14 @@ package org.mozilla.gecko.tabs; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; +import android.graphics.LinearGradient; +import android.graphics.Paint; import android.graphics.Rect; +import android.graphics.Shader; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.animation.DecelerateInterpolator; import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnPreDrawListener; import com.nineoldandroids.animation.Animator; @@ -49,6 +50,9 @@ public class TabStripView extends TwoWayView { private boolean isPrivate; + private final Paint fadingEdgePaint; + private final int fadingEdgeSize; + public TabStripView(Context context, AttributeSet attrs) { super(context, attrs); @@ -69,6 +73,10 @@ public class TabStripView extends TwoWayView { animatorListener = new TabAnimatorListener(); + fadingEdgePaint = new Paint(); + fadingEdgeSize = + resources.getDimensionPixelOffset(R.dimen.new_tablet_tab_strip_fading_edge_size); + adapter = new TabStripAdapter(context); setAdapter(adapter); } @@ -265,6 +273,35 @@ public class TabStripView extends TwoWayView { } } + private float getFadingEdgeStrength() { + final int childCount = getChildCount(); + if (childCount == 0) { + return 0.0f; + } else { + if (getFirstVisiblePosition() + childCount - 1 < adapter.getCount() - 1) { + return 1.0f; + } + + final int right = getChildAt(childCount - 1).getRight(); + final int paddingRight = getPaddingRight(); + final int width = getWidth(); + + final float strength = (right > width - paddingRight ? + (float) (right - width + paddingRight) / fadingEdgeSize : 0.0f); + + return Math.max(0.0f, Math.min(strength, 1.0f)); + } + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + + fadingEdgePaint.setShader(new LinearGradient(w - fadingEdgeSize, 0, w, 0, + new int[] { 0x0, 0x11292C29, 0xDD292C29 }, + new float[] { 0, 0.4f, 1.0f }, Shader.TileMode.CLAMP)); + } + @Override protected int getChildDrawingOrder(int childCount, int i) { final int checkedIndex = getCheckedIndex(childCount); @@ -283,10 +320,7 @@ public class TabStripView extends TwoWayView { } } - @Override - public void draw(Canvas canvas) { - super.draw(canvas); - + private void drawDividers(Canvas canvas) { final int bottom = getHeight() - getPaddingBottom() - dividerPadding.bottom; final int top = bottom - divider.getIntrinsicHeight(); @@ -316,6 +350,22 @@ public class TabStripView extends TwoWayView { } } + private void drawFadingEdge(Canvas canvas) { + final float strength = getFadingEdgeStrength(); + if (strength > 0.0f) { + final int r = getRight(); + canvas.drawRect(r - fadingEdgeSize, getTop(), r, getBottom(), fadingEdgePaint); + fadingEdgePaint.setAlpha((int) (strength * 255)); + } + } + + @Override + public void draw(Canvas canvas) { + super.draw(canvas); + drawDividers(canvas); + drawFadingEdge(canvas); + } + private class TabAnimatorListener implements AnimatorListener { private void setLayerType(int layerType) { final int childCount = getChildCount(); From 75126d32e349c9967bf690afd4c5c2700cd9c1b7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:50:17 -0800 Subject: [PATCH 104/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/b810b68a8db1 Author: Rob Wood Desc: Merge pull request #26416 from rwood-moz/bug1095080 Bug 1095080 - Fix browser endurance tests ======== https://hg.mozilla.org/integration/gaia-central/rev/f6cf8d26719e Author: Rob Wood Desc: Bug 1095080 - Fix browser endurance tests --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c5ee647c448e..c3cae654ebc3 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "f3637cd27193e8eca7796781ef2f3a4fbcbe06a1", + "revision": "b810b68a8db1dc162cc96123fc3e2732278ce24f", "repo_path": "integration/gaia-central" } From df08bc3e163152cf21aeac4afe16fe473fe46f4a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 11:57:11 -0800 Subject: [PATCH 105/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index a21b3d64e8b2..b43412018c92 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8e7fe4c28b73..0f4233a1c62b 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 5dc287bdda09..447744df9564 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d6ca55aaf8d2..f05ad1abafee 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8e7fe4c28b73..0f4233a1c62b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 5a92a91f052b..44fbb86c8c82 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f844a37677e1..269c0c29ce61 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b9b7721d97d3..a7bedcbc1a5a 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index c00f5ade0081..4b25618475e5 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index a421162d0374..b1559c0b23a2 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 730cc9a8e51b..cf8e2eef85b9 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 24bd6339dd23210fae5e7b63e9f2268d6069c5f7 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Wed, 26 Nov 2014 21:13:18 +0100 Subject: [PATCH 106/121] Bug 1105456 - Temporarily disable Unified Complete due to recent regressions. r=post-facto a=ryanVM for pushing on a CLOSED TREE central --HG-- extra : histedit_source : 040465fdd50a2b6a310a8e2169ddad9b7d1d4500 --- browser/app/profile/firefox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 06cd95cd3f0f..f449738b706d 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -323,7 +323,7 @@ pref("browser.urlbar.autoFill", true); pref("browser.urlbar.autoFill.typed", true); // Use the new unifiedComplete component -pref("browser.urlbar.unifiedcomplete", true); +pref("browser.urlbar.unifiedcomplete", false); // 0: Match anywhere (e.g., middle of words) // 1: Match on word boundaries and then try matching anywhere From 34e32086ead51cdc1823a00d4cbd1c291a3ce60d Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 26 Nov 2014 21:09:09 +0000 Subject: [PATCH 107/121] Follow-up to bug 1079225 - Fix formatting of the waiting for media message in Loop rooms, and ensure feedback can be given for multiple conversations in a row. r=abr --- .../loop/content/shared/js/actions.js | 5 +++-- .../loop/content/shared/js/activeRoomStore.js | 8 +++++--- .../loop/content/shared/js/feedbackStore.js | 11 +++++++++- .../loop/content/shared/js/store.js | 11 ++++++++++ .../content/js/standaloneRoomViews.js | 8 +++++--- .../content/js/standaloneRoomViews.jsx | 10 ++++++---- .../loop/standalone/content/js/webapp.js | 7 ++++--- .../loop/standalone/content/js/webapp.jsx | 7 ++++--- .../loop/test/shared/activeRoomStore_test.js | 4 ++-- .../loop/test/shared/feedbackStore_test.js | 12 +++++++++++ .../standalone/standaloneRoomViews_test.js | 20 +++++++++++-------- 11 files changed, 74 insertions(+), 29 deletions(-) diff --git a/browser/components/loop/content/shared/js/actions.js b/browser/components/loop/content/shared/js/actions.js index cd4491073dec..5355d4fb11b6 100644 --- a/browser/components/loop/content/shared/js/actions.js +++ b/browser/components/loop/content/shared/js/actions.js @@ -331,9 +331,10 @@ loop.shared.actions = (function() { }), /** - * Resets current room. + * Used to indicate that the feedback cycle is completed and the countdown + * finished. */ - ResetRoom: Action.define("resetRoom", { + FeedbackComplete: Action.define("feedbackComplete", { }), /** diff --git a/browser/components/loop/content/shared/js/activeRoomStore.js b/browser/components/loop/content/shared/js/activeRoomStore.js index 8ff38125b286..da9ea7a65d0a 100644 --- a/browser/components/loop/content/shared/js/activeRoomStore.js +++ b/browser/components/loop/content/shared/js/activeRoomStore.js @@ -140,7 +140,7 @@ loop.store.ActiveRoomStore = (function() { "remotePeerConnected", "windowUnload", "leaveRoom", - "resetRoom" + "feedbackComplete" ]); }, @@ -453,9 +453,11 @@ loop.store.ActiveRoomStore = (function() { }, /** - * Resets current room. + * When feedback is complete, we reset the room to the initial state. */ - resetRoom: function() { + feedbackComplete: function() { + // Note, that we want some values, such as the windowId, so we don't + // do a full reset here. this.setStoreState(this.getInitialStoreState()); } }); diff --git a/browser/components/loop/content/shared/js/feedbackStore.js b/browser/components/loop/content/shared/js/feedbackStore.js index a5b78e390ded..546c967c5eda 100644 --- a/browser/components/loop/content/shared/js/feedbackStore.js +++ b/browser/components/loop/content/shared/js/feedbackStore.js @@ -37,7 +37,8 @@ loop.store.FeedbackStore = (function() { actions: [ "requireFeedbackDetails", "sendFeedback", - "sendFeedbackError" + "sendFeedbackError", + "feedbackComplete" ], initialize: function(options) { @@ -91,6 +92,14 @@ loop.store.FeedbackStore = (function() { feedbackState: FEEDBACK_STATES.FAILED, error: actionData.error }); + }, + + /** + * Resets the store to its initial state as feedback has been completed, + * i.e. ready for the next round of feedback. + */ + feedbackComplete: function() { + this.resetStoreState(); } }); diff --git a/browser/components/loop/content/shared/js/store.js b/browser/components/loop/content/shared/js/store.js index 1b6ed2be9dee..41f5ad8a623f 100644 --- a/browser/components/loop/content/shared/js/store.js +++ b/browser/components/loop/content/shared/js/store.js @@ -54,6 +54,17 @@ loop.store.createStore = (function() { this.trigger("change:" + key); } this.trigger("change"); + }, + + /** + * Resets the store state to the initially defined state. + */ + resetStoreState: function() { + if (typeof this.getInitialStoreState === "function") { + this._storeState = this.getInitialStoreState(); + } else { + this._storeState = {}; + } } }; diff --git a/browser/components/loop/standalone/content/js/standaloneRoomViews.js b/browser/components/loop/standalone/content/js/standaloneRoomViews.js index 72116f0107c0..59a595a41118 100644 --- a/browser/components/loop/standalone/content/js/standaloneRoomViews.js +++ b/browser/components/loop/standalone/content/js/standaloneRoomViews.js @@ -29,7 +29,7 @@ loop.standaloneRoomViews = (function(mozL10n) { onFeedbackSent: function() { // We pass a tick to prevent React warnings regarding nested updates. setTimeout(function() { - this.props.activeRoomStore.dispatchAction(new sharedActions.ResetRoom()); + this.props.activeRoomStore.dispatchAction(new sharedActions.FeedbackComplete()); }.bind(this)); }, @@ -85,8 +85,10 @@ loop.standaloneRoomViews = (function(mozL10n) { {clientShortname: mozL10n.get("clientShortname2")}); // XXX Bug 1047040 will add images to help prompt the user. return ( - React.DOM.p({className: "prompt-media-message"}, - msg + React.DOM.div({className: "room-inner-info-area"}, + React.DOM.p({className: "prompt-media-message"}, + msg + ) ) ); } diff --git a/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx b/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx index adaa0e5ca221..44582835fa6c 100644 --- a/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx +++ b/browser/components/loop/standalone/content/js/standaloneRoomViews.jsx @@ -29,7 +29,7 @@ loop.standaloneRoomViews = (function(mozL10n) { onFeedbackSent: function() { // We pass a tick to prevent React warnings regarding nested updates. setTimeout(function() { - this.props.activeRoomStore.dispatchAction(new sharedActions.ResetRoom()); + this.props.activeRoomStore.dispatchAction(new sharedActions.FeedbackComplete()); }.bind(this)); }, @@ -85,9 +85,11 @@ loop.standaloneRoomViews = (function(mozL10n) { {clientShortname: mozL10n.get("clientShortname2")}); // XXX Bug 1047040 will add images to help prompt the user. return ( -

- {msg} -

+
+

+ {msg} +

+
); } case ROOM_STATES.JOINED: diff --git a/browser/components/loop/standalone/content/js/webapp.js b/browser/components/loop/standalone/content/js/webapp.js index 98177bc0eafc..37f66a37dc1c 100644 --- a/browser/components/loop/standalone/content/js/webapp.js +++ b/browser/components/loop/standalone/content/js/webapp.js @@ -690,9 +690,10 @@ loop.webapp = (function($, _, OT, mozL10n) { return nextState.callStatus !== this.state.callStatus; }, - callStatusSwitcher: function(status) { + resetCallStatus: function() { + this.props.feedbackStore.dispatchAction(new sharedActions.FeedbackComplete()); return function() { - this.setState({callStatus: status}); + this.setState({callStatus: "start"}); }.bind(this); }, @@ -744,7 +745,7 @@ loop.webapp = (function($, _, OT, mozL10n) { sdk: this.props.sdk, conversation: this.props.conversation, feedbackStore: this.props.feedbackStore, - onAfterFeedbackReceived: this.callStatusSwitcher("start")} + onAfterFeedbackReceived: this.resetCallStatus()} ) ); } diff --git a/browser/components/loop/standalone/content/js/webapp.jsx b/browser/components/loop/standalone/content/js/webapp.jsx index 3e786340d43a..9cd697566a8b 100644 --- a/browser/components/loop/standalone/content/js/webapp.jsx +++ b/browser/components/loop/standalone/content/js/webapp.jsx @@ -690,9 +690,10 @@ loop.webapp = (function($, _, OT, mozL10n) { return nextState.callStatus !== this.state.callStatus; }, - callStatusSwitcher: function(status) { + resetCallStatus: function() { + this.props.feedbackStore.dispatchAction(new sharedActions.FeedbackComplete()); return function() { - this.setState({callStatus: status}); + this.setState({callStatus: "start"}); }.bind(this); }, @@ -744,7 +745,7 @@ loop.webapp = (function($, _, OT, mozL10n) { sdk={this.props.sdk} conversation={this.props.conversation} feedbackStore={this.props.feedbackStore} - onAfterFeedbackReceived={this.callStatusSwitcher("start")} + onAfterFeedbackReceived={this.resetCallStatus()} /> ); } diff --git a/browser/components/loop/test/shared/activeRoomStore_test.js b/browser/components/loop/test/shared/activeRoomStore_test.js index cb872cc3be4b..a75836ef2252 100644 --- a/browser/components/loop/test/shared/activeRoomStore_test.js +++ b/browser/components/loop/test/shared/activeRoomStore_test.js @@ -264,7 +264,7 @@ describe("loop.store.ActiveRoomStore", function () { }); }); - describe("#resetRoom", function() { + describe("#feedbackComplete", function() { it("should reset the room store state", function() { var initialState = store.getInitialStoreState(); store.setStoreState({ @@ -274,7 +274,7 @@ describe("loop.store.ActiveRoomStore", function () { failureReason: "foo" }); - store.resetRoom(new sharedActions.ResetRoom()); + store.feedbackComplete(new sharedActions.FeedbackComplete()); expect(store.getStoreState()).eql(initialState); }); diff --git a/browser/components/loop/test/shared/feedbackStore_test.js b/browser/components/loop/test/shared/feedbackStore_test.js index 8213189842a9..9cfcd6702687 100644 --- a/browser/components/loop/test/shared/feedbackStore_test.js +++ b/browser/components/loop/test/shared/feedbackStore_test.js @@ -105,4 +105,16 @@ describe("loop.store.FeedbackStore", function () { store.sendFeedback(new sharedActions.SendFeedback(sadFeedbackData)); }); }); + + describe("feedbackComplete", function() { + it("should reset the store state", function() { + store.setStoreState({feedbackState: FEEDBACK_STATES.SENT}); + + store.feedbackComplete(); + + expect(store.getStoreState()).eql({ + feedbackState: FEEDBACK_STATES.INIT + }); + }); + }); }); diff --git a/browser/components/loop/test/standalone/standaloneRoomViews_test.js b/browser/components/loop/test/standalone/standaloneRoomViews_test.js index b72bb3a88ec2..7dac026c13ca 100644 --- a/browser/components/loop/test/standalone/standaloneRoomViews_test.js +++ b/browser/components/loop/test/standalone/standaloneRoomViews_test.js @@ -291,21 +291,25 @@ describe("loop.standaloneRoomViews", function() { }); describe("Feedback", function() { + beforeEach(function() { + activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED}); + }); + it("should display a feedback form when the user leaves the room", function() { - activeRoomStore.setStoreState({roomState: ROOM_STATES.ENDED}); - expect(view.getDOMNode().querySelector(".faces")).not.eql(null); }); - it("should reinit the view after feedback is sent", function() { - feedbackStore.setStoreState({feedbackState: FEEDBACK_STATES.SENT}); + it("should dispatch a `FeedbackComplete` action after feedback is sent", + function() { + feedbackStore.setStoreState({feedbackState: FEEDBACK_STATES.SENT}); - sandbox.clock.tick( - loop.shared.views.WINDOW_AUTOCLOSE_TIMEOUT_IN_SECONDS * 1000); + sandbox.clock.tick( + loop.shared.views.WINDOW_AUTOCLOSE_TIMEOUT_IN_SECONDS * 1000 + 1000); - expect(view.getDOMNode().querySelector(".btn-join")).not.eql(null); - }); + sinon.assert.calledOnce(dispatch); + sinon.assert.calledWithExactly(dispatch, new sharedActions.FeedbackComplete()); + }); }); }); }); From f9aa45809c60bbf32ae7bf6cb7b1dab4721a4466 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 26 Nov 2014 22:03:10 +0000 Subject: [PATCH 108/121] Bug 1105488 Update Privacy and ToS URLs for Loop. r=jaws --- browser/app/profile/firefox.js | 4 ++-- browser/components/loop/standalone/Makefile | 4 ++-- browser/components/loop/standalone/server.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 06cd95cd3f0f..1dacd2ddbb55 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1647,8 +1647,8 @@ pref("loop.seenToS", "unseen"); pref("loop.gettingStarted.seen", false); pref("loop.gettingStarted.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/hello/start"); pref("loop.learnMoreUrl", "https://www.firefox.com/hello/"); -pref("loop.legal.ToS_url", "https://hello.firefox.com/legal/terms/"); -pref("loop.legal.privacy_url", "https://www.mozilla.org/privacy/"); +pref("loop.legal.ToS_url", "https://www.mozilla.org/about/legal/terms/firefox-hello/"); +pref("loop.legal.privacy_url", "https://www.mozilla.org/privacy/firefox-hello/"); pref("loop.do_not_disturb", false); pref("loop.ringtone", "chrome://browser/content/loop/shared/sounds/ringtone.ogg"); pref("loop.retry_delay.start", 60000); diff --git a/browser/components/loop/standalone/Makefile b/browser/components/loop/standalone/Makefile index e9e6fdc72e88..506e9d0154ba 100644 --- a/browser/components/loop/standalone/Makefile +++ b/browser/components/loop/standalone/Makefile @@ -16,8 +16,8 @@ LOOP_SERVER_URL := $(shell echo $${LOOP_SERVER_URL-http://localhost:5000/v0}) LOOP_FEEDBACK_API_URL := $(shell echo $${LOOP_FEEDBACK_API_URL-"https://input.allizom.org/api/v1/feedback"}) LOOP_FEEDBACK_PRODUCT_NAME := $(shell echo $${LOOP_FEEDBACK_PRODUCT_NAME-Loop}) LOOP_BRAND_WEBSITE_URL := $(shell echo $${LOOP_BRAND_WEBSITE_URL-"https://www.mozilla.org/firefox/"}) -LOOP_PRIVACY_WEBSITE_URL := $(shell echo $${LOOP_PRIVACY_WEBSITE_URL-"https://www.mozilla.org/privacy"}) -LOOP_LEGAL_WEBSITE_URL := $(shell echo $${LOOP_LEGAL_WEBSITE_URL-"/legal/terms"}) +LOOP_PRIVACY_WEBSITE_URL := $(shell echo $${LOOP_PRIVACY_WEBSITE_URL-"https://www.mozilla.org/privacy/firefox-hello/"}) +LOOP_LEGAL_WEBSITE_URL := $(shell echo $${LOOP_LEGAL_WEBSITE_URL-"https://www.mozilla.org/about/legal/terms/firefox-hello/"}) LOOP_PRODUCT_HOMEPAGE_URL := $(shell echo $${LOOP_PRODUCT_HOMEPAGE_URL-"https://www.firefox.com/hello/"}) NODE_LOCAL_BIN=./node_modules/.bin diff --git a/browser/components/loop/standalone/server.js b/browser/components/loop/standalone/server.js index 0893f3c5e946..b94ffb248ca5 100644 --- a/browser/components/loop/standalone/server.js +++ b/browser/components/loop/standalone/server.js @@ -25,9 +25,9 @@ function getConfigFile(req, res) { // uploaded to the marketplace bug 1053424 "loop.config.marketplaceUrl = 'http://fake-market.herokuapp.com/iframe-install.html'", "loop.config.brandWebsiteUrl = 'https://www.mozilla.org/firefox/';", - "loop.config.privacyWebsiteUrl = 'https://www.mozilla.org/privacy';", + "loop.config.privacyWebsiteUrl = 'https://www.mozilla.org/privacy/firefox-hello/';", "loop.config.learnMoreUrl = 'https://www.mozilla.org/hello/';", - "loop.config.legalWebsiteUrl = '/legal/terms';", + "loop.config.legalWebsiteUrl = 'https://www.mozilla.org/about/legal/terms/firefox-hello/';", "loop.config.fxosApp = loop.config.fxosApp || {};", "loop.config.fxosApp.name = 'Loop';", "loop.config.fxosApp.manifestUrl = 'http://fake-market.herokuapp.com/apps/packagedApp/manifest.webapp';", From b81685e028fd5f504ebdb17c37dcc5a59c6c4d41 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 27 Nov 2014 00:00:23 +0100 Subject: [PATCH 109/121] Backout ce637f8721d3 (bug 1083469) due to failures with old autocomplete enabled. a=bustage on CLOSED TREE --- toolkit/components/places/PlacesUtils.jsm | 119 ------------- toolkit/components/places/UnifiedComplete.js | 2 +- toolkit/components/places/nsNavBookmarks.cpp | 164 ++++++++++++------ toolkit/components/places/nsNavBookmarks.h | 15 +- .../components/places/nsPlacesAutoComplete.js | 134 +++++++------- ...sUtils_promiseHrefAndPostDataForKeyword.js | 117 ------------- .../components/places/tests/unit/xpcshell.ini | 1 - 7 files changed, 189 insertions(+), 363 deletions(-) delete mode 100644 toolkit/components/places/tests/unit/test_PlacesUtils_promiseHrefAndPostDataForKeyword.js diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm index 05ba61260c95..7ec5b61369c5 100644 --- a/toolkit/components/places/PlacesUtils.jsm +++ b/toolkit/components/places/PlacesUtils.jsm @@ -834,17 +834,6 @@ this.PlacesUtils = { return null; }, - /** - * Gets the href and the post data for a given keyword, if any. - * - * @param keyword - * The string keyword to look for. - * @return {Promise} - * @resolves to a { href, postData } object. Both properties evaluate to null - * if no keyword is found. - */ - promiseHrefAndPostDataForKeyword(keyword) KeywordsCache.promiseEntry(keyword), - /** * Get the URI (and any associated POST data) for a given keyword. * @param aKeyword string keyword @@ -1976,114 +1965,6 @@ let GuidHelper = { } }; -// Cache of bookmarks keywords, used to quickly resolve keyword => URL requests. -let KeywordsCache = { - /** - * Initializes the cache. - * Every method should check _initialized and, if false, yield _initialize(). - */ - _initialized: false, - _initialize: Task.async(function* () { - // First populate the cache... - yield this._reloadCache(); - - // ...then observe changes to keep the cache up-to-date. - PlacesUtils.bookmarks.addObserver(this, false); - PlacesUtils.registerShutdownFunction(() => { - PlacesUtils.bookmarks.removeObserver(this); - }); - - this._initialized = true; - }), - - // nsINavBookmarkObserver - // Manually updating the cache would be tricky because some notifications - // don't report the original bookmark url and we also keep urls sorted by - // last modified. Since changing a keyword-ed bookmark is a rare event, - // it's easier to reload the cache. - onItemChanged(itemId, property, isAnno, val, lastModified, type, - parentId, guid, parentGuid) { - if (property == "keyword" || property == this.POST_DATA_ANNO || - this._keywordedGuids.has(guid)) { - // Since this cache is used in hot paths, it should be readily available - // as fast as possible. - this._reloadCache().catch(Cu.reportError); - } - }, - onItemRemoved(itemId, parentId, index, type, uri, guid, parentGuid) { - if (this._keywordedGuids.has(guid)) { - // Since this cache is used in hot paths, it should be readily available - // as fast as possible. - this._reloadCache().catch(Cu.reportError); - } - }, - QueryInterface: XPCOMUtils.generateQI([ Ci.nsINavBookmarkObserver ]), - __noSuchMethod__() {}, // Catch all remaining onItem* methods. - - // Maps an { href, postData } object to each keyword. - // Even if a keyword may be associated to multiple URLs, only the last - // modified bookmark href is retained here. - _urlDataForKeyword: null, - // Tracks GUIDs having a keyword. - _keywordedGuids: null, - - /** - * Reloads the cache. - */ - _reloadPromise: null, - _reloadCache() { - return this._reloadPromise = Task.spawn(function* () { - let db = yield PlacesUtils.promiseDBConnection(); - let rows = yield db.execute( - `/* do not warn (bug no) - there is no index on keyword_id */ - SELECT b.id, b.guid, h.url, k.keyword FROM moz_bookmarks b - JOIN moz_places h ON h.id = b.fk - JOIN moz_keywords k ON k.id = b.keyword_id - ORDER BY b.lastModified DESC - `); - - this._urlDataForKeyword = new Map(); - this._keywordedGuids = new Set(); - - for (let row of rows) { - let guid = row.getResultByName("guid"); - this._keywordedGuids.add(guid); - - let keyword = row.getResultByName("keyword"); - // Only keep the most recent href. - let urlData = this._urlDataForKeyword.get(keyword); - if (urlData) - continue; - - let id = row.getResultByName("id"); - let href = row.getResultByName("url"); - let postData = PlacesUtils.getPostDataForBookmark(id); - this._urlDataForKeyword.set(keyword, { href, postData }); - } - }.bind(this)).then(() => { - this._reloadPromise = null; - }); - }, - - /** - * Fetches a { href, postData } entry for the given keyword. - * - * @param keyword - * The keyword to look for. - * @return {promise} - * @resolves when the fetching is complete. - */ - promiseEntry: Task.async(function* (keyword) { - // We could yield regardless and do the checks internally, but that would - // waste at least a couple ticks and this can be used on hot paths. - if (!this._initialized) - yield this._initialize(); - if (this._reloadPromise) - yield this._reloadPromise; - return this._urlDataForKeyword.get(keyword) || { href: null, postData: null }; - }), -}; - //////////////////////////////////////////////////////////////////////////////// //// Transactions handlers. diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js index 474812427399..a27a02a05aae 100644 --- a/toolkit/components/places/UnifiedComplete.js +++ b/toolkit/components/places/UnifiedComplete.js @@ -777,7 +777,7 @@ Search.prototype = { let hasFirstResult = false; if (this._searchTokens.length > 0 && - (yield PlacesUtils.promiseHrefAndPostDataForKeyword(this._searchTokens[0])).href) { + PlacesUtils.bookmarks.getURIForKeyword(this._searchTokens[0])) { // This may be a keyword of a bookmark. queries.unshift(this._keywordQuery); hasFirstResult = true; diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index bb2eaee55168..09ba90249498 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -19,6 +19,8 @@ #include "GeckoProfiler.h" +#define BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_LENGTH 32 + using namespace mozilla; // These columns sit to the right of the kGetInfoIndex_* columns. @@ -38,6 +40,25 @@ PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsNavBookmarks, gBookmarksService) namespace { +struct keywordSearchData +{ + int64_t itemId; + nsString keyword; +}; + +PLDHashOperator +SearchBookmarkForKeyword(nsTrimInt64HashKey::KeyType aKey, + const nsString aValue, + void* aUserArg) +{ + keywordSearchData* data = reinterpret_cast(aUserArg); + if (data->keyword.Equals(aValue)) { + data->itemId = aKey; + return PL_DHASH_STOP; + } + return PL_DHASH_NEXT; +} + template class AsyncGetBookmarksForURI : public AsyncStatementCallback { @@ -122,6 +143,8 @@ nsNavBookmarks::nsNavBookmarks() , mCanNotify(false) , mCacheObservers("bookmark-observers") , mBatching(false) + , mBookmarkToKeywordHash(BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_LENGTH) + , mBookmarkToKeywordHashInitialized(false) { NS_ASSERTION(!gBookmarksService, "Attempting to create two instances of the service!"); @@ -623,7 +646,7 @@ nsNavBookmarks::RemoveItem(int64_t aItemId) NS_ENSURE_SUCCESS(rv, rv); } - rv = removeOrphanKeywords(); + rv = UpdateKeywordsHashForRemovedBookmark(aItemId); NS_ENSURE_SUCCESS(rv, rv); // A broken url should not interrupt the removal process. @@ -1096,7 +1119,7 @@ nsNavBookmarks::RemoveFolderChildren(int64_t aFolderId) NS_ENSURE_SUCCESS(rv, rv); } - rv = removeOrphanKeywords(); + rv = UpdateKeywordsHashForRemovedBookmark(child.id); NS_ENSURE_SUCCESS(rv, rv); } } @@ -2232,23 +2255,39 @@ nsNavBookmarks::SetItemIndex(int64_t aItemId, int32_t aNewIndex) nsresult -nsNavBookmarks::removeOrphanKeywords() +nsNavBookmarks::UpdateKeywordsHashForRemovedBookmark(int64_t aItemId) { - // If the keyword is unused, remove it from the database. - nsCOMPtr stmt = mDB->GetAsyncStatement( - "DELETE FROM moz_keywords " - "WHERE NOT EXISTS ( " - "SELECT id " - "FROM moz_bookmarks " - "WHERE keyword_id = moz_keywords.id " - ")" - ); - NS_ENSURE_STATE(stmt); + nsAutoString keyword; + if (NS_SUCCEEDED(GetKeywordForBookmark(aItemId, keyword)) && + !keyword.IsEmpty()) { + nsresult rv = EnsureKeywordsHash(); + NS_ENSURE_SUCCESS(rv, rv); + mBookmarkToKeywordHash.Remove(aItemId); - nsCOMPtr pendingStmt; - nsresult rv = stmt->ExecuteAsync(nullptr, getter_AddRefs(pendingStmt)); - NS_ENSURE_SUCCESS(rv, rv); + // If the keyword is unused, remove it from the database. + keywordSearchData searchData; + searchData.keyword.Assign(keyword); + searchData.itemId = -1; + mBookmarkToKeywordHash.EnumerateRead(SearchBookmarkForKeyword, &searchData); + if (searchData.itemId == -1) { + nsCOMPtr stmt = mDB->GetAsyncStatement( + "DELETE FROM moz_keywords " + "WHERE keyword = :keyword " + "AND NOT EXISTS ( " + "SELECT id " + "FROM moz_bookmarks " + "WHERE keyword_id = moz_keywords.id " + ")" + ); + NS_ENSURE_STATE(stmt); + rv = stmt->BindStringByName(NS_LITERAL_CSTRING("keyword"), keyword); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr pendingStmt; + rv = stmt->ExecuteAsync(nullptr, getter_AddRefs(pendingStmt)); + NS_ENSURE_SUCCESS(rv, rv); + } + } return NS_OK; } @@ -2264,6 +2303,9 @@ nsNavBookmarks::SetKeywordForBookmark(int64_t aBookmarkId, nsresult rv = FetchItemInfo(aBookmarkId, bookmark); NS_ENSURE_SUCCESS(rv, rv); + rv = EnsureKeywordsHash(); + NS_ENSURE_SUCCESS(rv, rv); + // Shortcuts are always lowercased internally. nsAutoString keyword(aUserCasedKeyword); ToLowerCase(keyword); @@ -2289,6 +2331,8 @@ nsNavBookmarks::SetKeywordForBookmark(int64_t aBookmarkId, mozStorageStatementScoper updateBookmarkScoper(updateBookmarkStmt); if (keyword.IsEmpty()) { + // Remove keyword association from the hash. + mBookmarkToKeywordHash.Remove(bookmark.id); rv = updateBookmarkStmt->BindNullByName(NS_LITERAL_CSTRING("keyword")); } else { @@ -2306,6 +2350,10 @@ nsNavBookmarks::SetKeywordForBookmark(int64_t aBookmarkId, rv = newKeywordStmt->Execute(); NS_ENSURE_SUCCESS(rv, rv); + // Add new keyword association to the hash, removing the old one if needed. + if (!oldKeyword.IsEmpty()) + mBookmarkToKeywordHash.Remove(bookmark.id); + mBookmarkToKeywordHash.Put(bookmark.id, keyword); rv = updateBookmarkStmt->BindStringByName(NS_LITERAL_CSTRING("keyword"), keyword); } NS_ENSURE_SUCCESS(rv, rv); @@ -2363,12 +2411,12 @@ nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword) rv = stmt->ExecuteStep(&hasMore); if (NS_FAILED(rv) || !hasMore) { aKeyword.SetIsVoid(true); - return NS_OK; + return NS_OK; // not found: return void keyword string } + // found, get the keyword rv = stmt->GetString(0, aKeyword); NS_ENSURE_SUCCESS(rv, rv); - return NS_OK; } @@ -2379,28 +2427,16 @@ nsNavBookmarks::GetKeywordForBookmark(int64_t aBookmarkId, nsAString& aKeyword) NS_ENSURE_ARG_MIN(aBookmarkId, 1); aKeyword.Truncate(0); - nsCOMPtr stmt = mDB->GetStatement( - "/* do not warn (bug no) - there is no index on keyword_id) */ " - "SELECT k.keyword " - "FROM moz_bookmarks b " - "JOIN moz_keywords k ON k.id = b.keyword_id " - "WHERE b.id = :id " - ); - NS_ENSURE_STATE(stmt); - mozStorageStatementScoper scoper(stmt); - - nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), aBookmarkId); + nsresult rv = EnsureKeywordsHash(); NS_ENSURE_SUCCESS(rv, rv); - bool hasMore = false; - rv = stmt->ExecuteStep(&hasMore); - if (NS_FAILED(rv) || !hasMore) { + nsAutoString keyword; + if (!mBookmarkToKeywordHash.Get(aBookmarkId, &keyword)) { aKeyword.SetIsVoid(true); - return NS_OK; } - - rv = stmt->GetString(0, aKeyword); - NS_ENSURE_SUCCESS(rv, rv); + else { + aKeyword.Assign(keyword); + } return NS_OK; } @@ -2418,33 +2454,53 @@ nsNavBookmarks::GetURIForKeyword(const nsAString& aUserCasedKeyword, nsAutoString keyword(aUserCasedKeyword); ToLowerCase(keyword); - nsCOMPtr stmt = mDB->GetStatement( - "/* do not warn (bug no) - there is no index on keyword_id) */ " - "SELECT url FROM moz_keywords k " - "JOIN moz_bookmarks b ON b.keyword_id = k.id " - "JOIN moz_places h ON b.fk = h.id " - "WHERE k.keyword = :keyword " - "ORDER BY b.dateAdded DESC" - ); - NS_ENSURE_STATE(stmt); - mozStorageStatementScoper scoper(stmt); - - nsresult rv = stmt->BindStringByName(NS_LITERAL_CSTRING("keyword"), keyword); + nsresult rv = EnsureKeywordsHash(); NS_ENSURE_SUCCESS(rv, rv); - bool hasMore = false; - rv = stmt->ExecuteStep(&hasMore); - if (NS_FAILED(rv) || !hasMore) { + keywordSearchData searchData; + searchData.keyword.Assign(keyword); + searchData.itemId = -1; + mBookmarkToKeywordHash.EnumerateRead(SearchBookmarkForKeyword, &searchData); + + if (searchData.itemId == -1) { + // Not found. return NS_OK; } - nsCString url; - rv = stmt->GetUTF8String(0, url); + rv = GetBookmarkURI(searchData.itemId, aURI); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewURI(aURI, url); + return NS_OK; +} + + +nsresult +nsNavBookmarks::EnsureKeywordsHash() { + if (mBookmarkToKeywordHashInitialized) { + return NS_OK; + } + mBookmarkToKeywordHashInitialized = true; + + nsCOMPtr stmt; + nsresult rv = mDB->MainConn()->CreateStatement(NS_LITERAL_CSTRING( + "SELECT b.id, k.keyword " + "FROM moz_bookmarks b " + "JOIN moz_keywords k ON k.id = b.keyword_id " + ), getter_AddRefs(stmt)); NS_ENSURE_SUCCESS(rv, rv); + bool hasMore; + while (NS_SUCCEEDED(stmt->ExecuteStep(&hasMore)) && hasMore) { + int64_t itemId; + rv = stmt->GetInt64(0, &itemId); + NS_ENSURE_SUCCESS(rv, rv); + nsAutoString keyword; + rv = stmt->GetString(1, keyword); + NS_ENSURE_SUCCESS(rv, rv); + + mBookmarkToKeywordHash.Put(itemId, keyword); + } + return NS_OK; } diff --git a/toolkit/components/places/nsNavBookmarks.h b/toolkit/components/places/nsNavBookmarks.h index bb40309d137c..4e9bf1769a09 100644 --- a/toolkit/components/places/nsNavBookmarks.h +++ b/toolkit/components/places/nsNavBookmarks.h @@ -422,9 +422,20 @@ private: bool mBatching; /** - * Removes orphan keywords. + * Always call EnsureKeywordsHash() and check it for errors before actually + * using the hash. Internal keyword methods are already doing that. */ - nsresult removeOrphanKeywords(); + nsresult EnsureKeywordsHash(); + nsDataHashtable mBookmarkToKeywordHash; + bool mBookmarkToKeywordHashInitialized; + + /** + * This function must be called every time a bookmark is removed. + * + * @param aURI + * Uri to test. + */ + nsresult UpdateKeywordsHashForRemovedBookmark(int64_t aItemId); }; #endif // nsNavBookmarks_h_ diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js index 834a407c319a..155c49c2fca7 100644 --- a/toolkit/components/places/nsPlacesAutoComplete.js +++ b/toolkit/components/places/nsPlacesAutoComplete.js @@ -12,8 +12,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", "resource://gre/modules/TelemetryStopwatch.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Task", - "resource://gre/modules/Task.jsm"); //////////////////////////////////////////////////////////////////////////////// //// Constants @@ -1456,76 +1454,74 @@ urlInlineComplete.prototype = { this._listener = aListener; - Task.spawn(function* () { - // Don't autoFill if the search term is recognized as a keyword, otherwise - // it will override default keywords behavior. Note that keywords are - // hashed on first use, so while the first query may delay a little bit, - // next ones will just hit the memory hash. - if (this._currentSearchString.length == 0 || !this._db || - (yield PlacesUtils.promiseHrefAndPostDataForKeyword(this._currentSearchString)).href) { + // Don't autoFill if the search term is recognized as a keyword, otherwise + // it will override default keywords behavior. Note that keywords are + // hashed on first use, so while the first query may delay a little bit, + // next ones will just hit the memory hash. + if (this._currentSearchString.length == 0 || !this._db || + PlacesUtils.bookmarks.getURIForKeyword(this._currentSearchString)) { + this._finishSearch(); + return; + } + + // Don't try to autofill if the search term includes any whitespace. + // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH + // tokenizer ends up trimming the search string and returning a value + // that doesn't match it, or is even shorter. + if (/\s/.test(this._currentSearchString)) { + this._finishSearch(); + return; + } + + // Hosts have no "/" in them. + let lastSlashIndex = this._currentSearchString.lastIndexOf("/"); + + // Search only URLs if there's a slash in the search string... + if (lastSlashIndex != -1) { + // ...but not if it's exactly at the end of the search string. + if (lastSlashIndex < this._currentSearchString.length - 1) + this._queryURL(); + else this._finishSearch(); - return; - } + return; + } - // Don't try to autofill if the search term includes any whitespace. - // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH - // tokenizer ends up trimming the search string and returning a value - // that doesn't match it, or is even shorter. - if (/\s/.test(this._currentSearchString)) { - this._finishSearch(); - return; - } - - // Hosts have no "/" in them. - let lastSlashIndex = this._currentSearchString.lastIndexOf("/"); - - // Search only URLs if there's a slash in the search string... - if (lastSlashIndex != -1) { - // ...but not if it's exactly at the end of the search string. - if (lastSlashIndex < this._currentSearchString.length - 1) - this._queryURL(); - else - this._finishSearch(); - return; - } - - // Do a synchronous search on the table of hosts. - let query = this._hostQuery; - query.params.search_string = this._currentSearchString.toLowerCase(); - // This is just to measure the delay to reach the UI, not the query time. - TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY); - let ac = this; - let wrapper = new AutoCompleteStatementCallbackWrapper(this, { - handleResult: function (aResultSet) { - let row = aResultSet.getNextRow(); - let trimmedHost = row.getResultByIndex(0); - let untrimmedHost = row.getResultByIndex(1); - // If the untrimmed value doesn't preserve the user's input just - // ignore it and complete to the found host. - if (untrimmedHost && - !untrimmedHost.toLowerCase().contains(ac._originalSearchString.toLowerCase())) { - untrimmedHost = null; - } - - ac._result.appendMatch(ac._strippedPrefix + trimmedHost, "", "", "", untrimmedHost); - - // handleCompletion() will cause the result listener to be called, and - // will display the result in the UI. - }, - - handleError: function (aError) { - Components.utils.reportError( - "URL Inline Complete: An async statement encountered an " + - "error: " + aError.result + ", '" + aError.message + "'"); - }, - - handleCompletion: function (aReason) { - TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY); - ac._finishSearch(); + // Do a synchronous search on the table of hosts. + let query = this._hostQuery; + query.params.search_string = this._currentSearchString.toLowerCase(); + // This is just to measure the delay to reach the UI, not the query time. + TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY); + let ac = this; + let wrapper = new AutoCompleteStatementCallbackWrapper(this, { + handleResult: function (aResultSet) { + let row = aResultSet.getNextRow(); + let trimmedHost = row.getResultByIndex(0); + let untrimmedHost = row.getResultByIndex(1); + // If the untrimmed value doesn't preserve the user's input just + // ignore it and complete to the found host. + if (untrimmedHost && + !untrimmedHost.toLowerCase().contains(ac._originalSearchString.toLowerCase())) { + untrimmedHost = null; } - }, this._db); - this._pendingQuery = wrapper.executeAsync([query]); - }.bind(this)); + + ac._result.appendMatch(ac._strippedPrefix + trimmedHost, "", "", "", untrimmedHost); + + // handleCompletion() will cause the result listener to be called, and + // will display the result in the UI. + }, + + handleError: function (aError) { + Components.utils.reportError( + "URL Inline Complete: An async statement encountered an " + + "error: " + aError.result + ", '" + aError.message + "'"); + }, + + handleCompletion: function (aReason) { + TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY); + ac._finishSearch(); + } + }, this._db); + this._pendingQuery = wrapper.executeAsync([query]); }, /** diff --git a/toolkit/components/places/tests/unit/test_PlacesUtils_promiseHrefAndPostDataForKeyword.js b/toolkit/components/places/tests/unit/test_PlacesUtils_promiseHrefAndPostDataForKeyword.js deleted file mode 100644 index e854daabc3e3..000000000000 --- a/toolkit/components/places/tests/unit/test_PlacesUtils_promiseHrefAndPostDataForKeyword.js +++ /dev/null @@ -1,117 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -add_task(function* test_no_keyword() { - Assert.deepEqual({ href: null, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should not exist"); -}); - -add_task(function* test_add_remove() { - let item1 = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example1.com/", - keyword: "test" }); - Assert.deepEqual({ href: item1.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item1.url.href); - - // Add a second url for the same keyword, since it's newer it should be - // returned. - let item2 = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example2.com/", - keyword: "test" }); - Assert.deepEqual({ href: item2.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item2.url.href); - - // Now remove item2, should return item1 again. - yield PlacesUtils.bookmarks.remove(item2); - Assert.deepEqual({ href: item1.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item1.url.href); - - // Now remove item1, should return null again. - yield PlacesUtils.bookmarks.remove(item1); - Assert.deepEqual({ href: null, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should not exist"); -}); - -add_task(function* test_change_url() { - let item = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example.com/", - keyword: "test" }); - Assert.deepEqual({ href: item.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item.url.href); - - // Change the bookmark url. - let updatedItem = yield PlacesUtils.bookmarks.update({ guid: item.guid, - url: "http://example2.com" }); - Assert.deepEqual({ href: updatedItem.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + updatedItem.url.href); - yield PlacesUtils.bookmarks.remove(updatedItem); -}); - -add_task(function* test_change_keyword() { - let item = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example.com/", - keyword: "test" }); - Assert.deepEqual({ href: item.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item.url.href); - - // Change the bookmark keywprd. - let updatedItem = yield PlacesUtils.bookmarks.update({ guid: item.guid, - keyword: "test2" }); - Assert.deepEqual({ href: null, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should not exist"); - Assert.deepEqual({ href: updatedItem.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test2")), - "Keyword 'test' should point to " + updatedItem.url.href); - - // Remove the bookmark keyword. - updatedItem = yield PlacesUtils.bookmarks.update({ guid: item.guid, - keyword: "" }); - Assert.deepEqual({ href: null, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should not exist"); - Assert.deepEqual({ href: null, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test2")), - "Keyword 'test' should not exist"); - yield PlacesUtils.bookmarks.remove(updatedItem); -}); - -add_task(function* test_postData() { - let item1 = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example1.com/", - keyword: "test" }); - let itemId1 = yield PlacesUtils.promiseItemId(item1.guid); - PlacesUtils.setPostDataForBookmark(itemId1, "testData"); - Assert.deepEqual({ href: item1.url.href, postData: "testData" }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item1.url.href); - - // Add a second url for the same keyword, but without postData. - let item2 = yield PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK, - parentGuid: PlacesUtils.bookmarks.unfiledGuid, - url: "http://example2.com/", - keyword: "test" }); - Assert.deepEqual({ href: item2.url.href, postData: null }, - (yield PlacesUtils.promiseHrefAndPostDataForKeyword("test")), - "Keyword 'test' should point to " + item2.url.href); - - yield PlacesUtils.bookmarks.remove(item1); - yield PlacesUtils.bookmarks.remove(item2); -}); - -function run_test() { - run_next_test(); -} diff --git a/toolkit/components/places/tests/unit/xpcshell.ini b/toolkit/components/places/tests/unit/xpcshell.ini index ebe9ed78b319..9eef3772191b 100644 --- a/toolkit/components/places/tests/unit/xpcshell.ini +++ b/toolkit/components/places/tests/unit/xpcshell.ini @@ -120,7 +120,6 @@ skip-if = true [test_PlacesSearchAutocompleteProvider.js] [test_PlacesUtils_asyncGetBookmarkIds.js] [test_PlacesUtils_lazyobservers.js] -[test_PlacesUtils_promiseHrefAndPostDataForKeyword.js] [test_placesTxn.js] [test_preventive_maintenance.js] # Bug 676989: test hangs consistently on Android From 9631c8c1db2ae7ba8d98ab217c87d6757c2af3ea Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 15:11:59 -0800 Subject: [PATCH 110/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/ff2728add438 Author: autolander Desc: Bug 1105521 - merge pull request #26500 from KevinGrandon:bug_1105521_remove_strings_sleep_menu to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/f13af46b1fd6 Author: Kevin Grandon Desc: Bug 1105521 - Remove strings from index.html for sleep menu --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c3cae654ebc3..e24aac31ba03 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "b810b68a8db1dc162cc96123fc3e2732278ce24f", + "revision": "ff2728add4389e6bb7d48c9856ad37486e955734", "repo_path": "integration/gaia-central" } From 608f902cdf657742b6a6bf007004dcba86e34f74 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 15:17:08 -0800 Subject: [PATCH 111/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index b43412018c92..f004231353d2 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 0f4233a1c62b..82fd9ea9f280 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 447744df9564..b6216b165b0a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index f05ad1abafee..45523d2f4a90 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 0f4233a1c62b..82fd9ea9f280 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 44fbb86c8c82..8c939e1e5382 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 269c0c29ce61..325fc26f4f34 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a7bedcbc1a5a..f254a0302242 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 4b25618475e5..da1a811ca4ae 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b1559c0b23a2..b7845717d4e4 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index cf8e2eef85b9..966615c7532c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 4882f7c4ff98a1333a62c07abda9e92ee06a6fd0 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 27 Nov 2014 00:41:50 +0100 Subject: [PATCH 112/121] bug 1105456 (follow-up) Make autocomplete tests not hit the new "failure on no test" behavior, so we can merge to Aurora too. r-irc=Unfocused a=bustage on CLOSED TREE --- browser/base/content/test/general/browser.ini | 2 +- browser/base/content/test/general/browser_action_keyword.js | 4 +++- .../content/test/general/browser_action_searchengine.js | 4 +++- .../content/test/general/browser_autocomplete_a11y_label.js | 4 +++- .../content/test/general/browser_autocomplete_autoselect.js | 6 ++++++ .../content/test/general/browser_autocomplete_no_title.js | 4 +++- .../test/general/browser_bug1003461-switchtab-override.js | 4 +++- browser/base/content/test/general/browser_bug1070778.js | 4 +++- .../content/test/general/browser_urlbarAutoFillTrimURLs.js | 5 ++++- 9 files changed, 29 insertions(+), 8 deletions(-) diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index f8a2ac8d75bc..9afc6a2cb476 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -413,7 +413,7 @@ skip-if = buildapp == 'mulet' || e10s [browser_tabMatchesInAwesomebar.js] skip-if = e10s # Bug 1093206 - need to re-enable tests relying on swapFrameLoaders et al for e10s (test calls gBrowser.swapBrowsersAndCloseOther) [browser_tabMatchesInAwesomebar_perwindowpb.js] -skip-if = e10s # Bug 1093373 - relies on browser.sessionHistory +skip-if = e10s || true # Bug 1093373, Bug 1104755 [browser_tab_drag_drop_perwindow.js] skip-if = buildapp == 'mulet' [browser_tab_dragdrop.js] diff --git a/browser/base/content/test/general/browser_action_keyword.js b/browser/base/content/test/general/browser_action_keyword.js index 06dd9ccd9f4b..6aee5b3c4cfd 100644 --- a/browser/base/content/test/general/browser_action_keyword.js +++ b/browser/base/content/test/general/browser_action_keyword.js @@ -16,8 +16,10 @@ function* promise_first_result(inputText) { add_task(function*() { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla"); let tabs = [tab]; diff --git a/browser/base/content/test/general/browser_action_searchengine.js b/browser/base/content/test/general/browser_action_searchengine.js index eece0c60a57e..3582b500e7b7 100644 --- a/browser/base/content/test/general/browser_action_searchengine.js +++ b/browser/base/content/test/general/browser_action_searchengine.js @@ -18,8 +18,10 @@ function* promise_first_result(inputText) { add_task(function* () { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET", "http://example.com/?q={searchTerms}"); diff --git a/browser/base/content/test/general/browser_autocomplete_a11y_label.js b/browser/base/content/test/general/browser_autocomplete_a11y_label.js index df30a26c77ea..b84500cad135 100644 --- a/browser/base/content/test/general/browser_autocomplete_a11y_label.js +++ b/browser/base/content/test/general/browser_autocomplete_a11y_label.js @@ -15,8 +15,10 @@ function* check_a11y_label(inputText, expectedLabel) { add_task(function*() { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } let tab = gBrowser.addTab("about:about"); yield promiseTabLoaded(tab); diff --git a/browser/base/content/test/general/browser_autocomplete_autoselect.js b/browser/base/content/test/general/browser_autocomplete_autoselect.js index ea7289576f58..9d767acbd70c 100644 --- a/browser/base/content/test/general/browser_autocomplete_autoselect.js +++ b/browser/base/content/test/general/browser_autocomplete_autoselect.js @@ -16,6 +16,12 @@ function is_selected(index) { } add_task(function*() { + // This test is only relevant if UnifiedComplete is enabled. + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); + return; + } + registerCleanupFunction(promiseClearHistory); let visits = []; diff --git a/browser/base/content/test/general/browser_autocomplete_no_title.js b/browser/base/content/test/general/browser_autocomplete_no_title.js index 51f936655167..3af3f6623cca 100644 --- a/browser/base/content/test/general/browser_autocomplete_no_title.js +++ b/browser/base/content/test/general/browser_autocomplete_no_title.js @@ -14,8 +14,10 @@ function* check_title(inputText, expectedTitle) { add_task(function*() { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } let uri = NetUtil.newURI("http://bug1060642.example.com/beards/are/pretty/great"); yield PlacesTestUtils.addVisits([{uri: uri, title: ""}]); diff --git a/browser/base/content/test/general/browser_bug1003461-switchtab-override.js b/browser/base/content/test/general/browser_bug1003461-switchtab-override.js index 1a71a028d5e8..8b1b68b90cd2 100644 --- a/browser/base/content/test/general/browser_bug1003461-switchtab-override.js +++ b/browser/base/content/test/general/browser_bug1003461-switchtab-override.js @@ -4,8 +4,10 @@ add_task(function* test_switchtab_override() { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } let testURL = "http://example.org/browser/browser/base/content/test/general/dummy_page.html"; diff --git a/browser/base/content/test/general/browser_bug1070778.js b/browser/base/content/test/general/browser_bug1070778.js index 81b6d2c0b056..a0ec32f20bd6 100644 --- a/browser/base/content/test/general/browser_bug1070778.js +++ b/browser/base/content/test/general/browser_bug1070778.js @@ -14,8 +14,10 @@ function is_selected(index) { add_task(function*() { // This test is only relevant if UnifiedComplete is enabled. - if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + if (!Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) { + todo(false, "Stop supporting old autocomplete components."); return; + } registerCleanupFunction(() => { PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId); diff --git a/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js b/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js index 0d6208de3e03..88c74cac129e 100644 --- a/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js +++ b/browser/base/content/test/general/browser_urlbarAutoFillTrimURLs.js @@ -54,7 +54,10 @@ function continue_test() { test_autoFill("http://au", "http://autofilltrimurl.com/", function () { test_autoFill("http://www.autofilltrimurl.com", "http://www.autofilltrimurl.com/", function () { // Now ensure selecting from the popup correctly trims. - is(gURLBar.controller.matchCount, 2, "Found the expected number of matches"); + if (Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete")) + is(gURLBar.controller.matchCount, 2, "Found the expected number of matches"); + else + is(gURLBar.controller.matchCount, 1, "Found the expected number of matches"); EventUtils.synthesizeKey("VK_DOWN", {}); is(gURLBar.textValue, "www.autofilltrimurl.com/whatever", "trim was applied correctly"); gURLBar.closePopup(); From 051c2cdacf58bdbe5b7f7f10b1f7007a53923a4a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 15:41:56 -0800 Subject: [PATCH 113/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/55dad48c2099 Author: autolander Desc: Bug 1105519 - merge pull request #26499 from KevinGrandon:bug_1105519_battery_overlay_strings to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/bb6df9503c2c Author: Kevin Grandon Desc: Bug 1105519 - Remove strings from index.html for battery dialog r=kgrandon --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index e24aac31ba03..1d6d4e0b63c1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "ff2728add4389e6bb7d48c9856ad37486e955734", + "revision": "55dad48c2099b7bad629d56ebcc6ddfd5fe09a8c", "repo_path": "integration/gaia-central" } From 7e3b33ea1a8cbbb653ac1d8529cfbc4f218aa514 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 15:52:02 -0800 Subject: [PATCH 114/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index f004231353d2..aa4f01363add 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 82fd9ea9f280..3929549d57c3 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b6216b165b0a..32099e312524 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 45523d2f4a90..d2f7a7383fa3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 82fd9ea9f280..3929549d57c3 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 8c939e1e5382..0a0abf8fa745 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 325fc26f4f34..a4ec5ce96221 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index f254a0302242..38d1343fd749 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index da1a811ca4ae..bcb93ab145db 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b7845717d4e4..b5d546725f74 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 966615c7532c..6f13fb7b4022 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 1e384b6bd5e2700efbe7725e7800d2ea97b6f9a6 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 26 Nov 2014 15:57:25 -0800 Subject: [PATCH 115/121] Bug 1102275 - Use layout params height instead of the dismiss view's calculated height when resetting the original height. r=bnicholson --- .../base/widget/SwipeDismissListViewTouchListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/widget/SwipeDismissListViewTouchListener.java b/mobile/android/base/widget/SwipeDismissListViewTouchListener.java index f6fb69914d40..0b1814643300 100644 --- a/mobile/android/base/widget/SwipeDismissListViewTouchListener.java +++ b/mobile/android/base/widget/SwipeDismissListViewTouchListener.java @@ -326,9 +326,9 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener { */ private void performDismiss(final View dismissView, final int dismissPosition) { final ViewGroup.LayoutParams lp = dismissView.getLayoutParams(); - final int originalHeight = dismissView.getHeight(); + final int originalHeight = lp.height; - ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime); + ValueAnimator animator = ValueAnimator.ofInt(dismissView.getHeight(), 1).setDuration(mAnimationTime); animator.addListener(new AnimatorListenerAdapter() { @Override From f872b9eb3f421619d2ca66cc9f173797a1588f36 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Wed, 26 Nov 2014 15:58:07 -0800 Subject: [PATCH 116/121] Bug 1095643 - Always show site identity info. r=mcomella --- mobile/android/base/toolbar/SiteIdentityPopup.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mobile/android/base/toolbar/SiteIdentityPopup.java b/mobile/android/base/toolbar/SiteIdentityPopup.java index 6c3070d266df..0a187b5a846f 100644 --- a/mobile/android/base/toolbar/SiteIdentityPopup.java +++ b/mobile/android/base/toolbar/SiteIdentityPopup.java @@ -92,20 +92,6 @@ public class SiteIdentityPopup extends ArrowPopup { init(); } - final MixedMode mixedMode = siteIdentity.getMixedMode(); - final TrackingMode trackingMode = siteIdentity.getTrackingMode(); - if (mixedMode != MixedMode.UNKNOWN || trackingMode != TrackingMode.UNKNOWN) { - // Hide the identity data if there isn't valid site identity data. - // Set some top padding on the popup content to create a of light blue - // between the popup arrow and the mixed content notification. - mContent.setPadding(0, (int) mContext.getResources().getDimension(R.dimen.identity_padding_top), 0, 0); - mIdentity.setVisibility(View.GONE); - return; - } - - mIdentity.setVisibility(View.VISIBLE); - mContent.setPadding(0, 0, 0, 0); - final boolean isIdentityKnown = (siteIdentity.getSecurityMode() != SecurityMode.UNKNOWN); toggleIdentityKnownContainerVisibility(isIdentityKnown); From 9d51b4ef2c870295b059839a823f20721e3702e5 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 16:17:00 -0800 Subject: [PATCH 117/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c8ac536548db Author: autolander Desc: Bug 1103629 - merge pull request #26384 from KevinGrandon:bug_1103629_marionette_client_loader_verticalhome to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/a1796499b69e Author: Kevin Grandon Desc: Bug 1103629 - [HomeScreen] Use a marionette client loader to include the home screen app --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1d6d4e0b63c1..b1098f3c2eb9 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "55dad48c2099b7bad629d56ebcc6ddfd5fe09a8c", + "revision": "c8ac536548dbbda88d8730b21068ff9779950d8c", "repo_path": "integration/gaia-central" } From 321a68ba5a591a2a96220dc7407dc7a09b988e85 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 16:21:35 -0800 Subject: [PATCH 118/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index aa4f01363add..b9df42700d3f 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3929549d57c3..8dbb684a5493 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 32099e312524..873c870d9a52 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d2f7a7383fa3..4ad2efdbab15 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3929549d57c3..8dbb684a5493 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 0a0abf8fa745..64dcd537b2b9 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a4ec5ce96221..3e63ca8dc3b2 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 38d1343fd749..cfba5536362e 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index bcb93ab145db..89c17096bb79 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b5d546725f74..4322fed33b3d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 6f13fb7b4022..4e84f9a57b9b 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 6f8791f06a1895ffd9e12687cefbf562da8c7208 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 27 Nov 2014 00:46:05 +0000 Subject: [PATCH 119/121] Bug 1105537 - Add string in prepartion for upcoming Loop improvements. r=MattN --- browser/components/loop/content/js/contacts.js | 2 +- browser/components/loop/content/js/contacts.jsx | 2 +- .../en-US/chrome/browser/loop/loop.properties | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/browser/components/loop/content/js/contacts.js b/browser/components/loop/content/js/contacts.js index 758529768675..0c8989e2a4db 100644 --- a/browser/components/loop/content/js/contacts.js +++ b/browser/components/loop/content/js/contacts.js @@ -635,7 +635,7 @@ loop.contacts = (function(_, mozL10n) { React.DOM.input({ref: "email", type: "email", required: phoneOrEmailRequired, className: cx({pristine: this.state.pristine}), valueLink: this.linkState("email")}), - React.DOM.label(null, mozL10n.get("new_contact_phone_placeholder")), + React.DOM.label(null, mozL10n.get("new_contact_fxos_phone_placeholder")), React.DOM.input({ref: "tel", type: "tel", required: phoneOrEmailRequired, className: cx({pristine: this.state.pristine}), valueLink: this.linkState("tel")}), diff --git a/browser/components/loop/content/js/contacts.jsx b/browser/components/loop/content/js/contacts.jsx index 39b505145238..7ccecf107d8b 100644 --- a/browser/components/loop/content/js/contacts.jsx +++ b/browser/components/loop/content/js/contacts.jsx @@ -635,7 +635,7 @@ loop.contacts = (function(_, mozL10n) { - + diff --git a/browser/locales/en-US/chrome/browser/loop/loop.properties b/browser/locales/en-US/chrome/browser/loop/loop.properties index ba1ef6ecdc33..7fe15c02b471 100644 --- a/browser/locales/en-US/chrome/browser/loop/loop.properties +++ b/browser/locales/en-US/chrome/browser/loop/loop.properties @@ -97,7 +97,8 @@ new_contact_button=New Contact ## and click the 'New Contact' button to see the fields. new_contact_name_placeholder=Name new_contact_email_placeholder=Email -new_contact_phone_placeholder=Firefox OS Phone +new_contact_fxos_phone_placeholder=Firefox OS Phone +new_contact_phone_placeholder2=Phone contacts_blocked_contacts=Blocked Contacts @@ -122,17 +123,13 @@ importing_contacts_progress_button=Importing… ## LOCALIZATION NOTE(sync_contacts_button): This button is displayed in place of ## importing_contacts_button once contacts have been imported once. sync_contacts_button=Sync Contacts + ## LOCALIZATION NOTE(import_failed_description simple): Displayed when an import of ## contacts fails. This is displayed in the error field here: ## https://people.mozilla.org/~dhenein/labs/loop-mvp-spec/#error import_failed_description_simple=Sorry, contact import failed -## LOCALIZATION NOTE(import_failed_description): Displayed when an import of contacts -## fails and the user may need more help. In this item, don't translate the part between -## {{..}} because this will be replaced by the label from import_failed_support_link_label. -## This is displayed in the error field here: -## https://people.mozilla.org/~dhenein/labs/loop-mvp-spec/#error -import_failed_description=Sorry, contact import failed, please see our {{import_failed_support_link_label}} for help -import_failed_support_link_label=support site +import_failed_description_some=Some contacts could not be imported +import_failed_support_button=Help ## LOCALIZATION NOTE(remove_contact_menu_button): Displayed in the contact list in ## a pop-up menu next to the contact's name. @@ -309,6 +306,8 @@ rooms_list_delete_tooltip=Delete conversation rooms_list_deleteConfirmation_label=Are you sure? rooms_list_no_current_conversations=No current conversations rooms_name_this_room_label=Name this conversation +rooms_name_this_room_tooltip=Click to edit the room name +rooms_name_change_failed_label=Conversation cannot be renamed rooms_new_room_button_label=Start a conversation rooms_only_occupant_label=You're the first one here. rooms_panel_title=Choose a conversation or start a new one @@ -317,3 +316,4 @@ rooms_room_full_call_to_action_nonFx_label=Download {{brandShortname}} to start rooms_room_full_call_to_action_label=Learn more about {{clientShortname}} » rooms_room_joined_label=Someone has joined the conversation! rooms_room_join_label=Join the conversation +rooms_signout_alert=Open conversations will be closed From adf8134b73d8e200af3260c8eebfcf5fa8c4bdde Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 18:31:57 -0800 Subject: [PATCH 120/121] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/05f40074f94c Author: Kevin Grandon Desc: Merge pull request #26502 from KevinGrandon/bug_1103964_disable_test Bug 1103964 - Disable test_everythingme_add_collection_save_bookmark.py test for starting to perma-fail ======== https://hg.mozilla.org/integration/gaia-central/rev/89e1ef758a65 Author: Kevin Grandon Desc: Bug 1103964 - Disable test_everythingme_add_collection_save_bookmark.py test for starting to perma-fail --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index b1098f3c2eb9..929aad28a195 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c8ac536548dbbda88d8730b21068ff9779950d8c", + "revision": "05f40074f94c58315e6c353089d31e8e20ea3c1a", "repo_path": "integration/gaia-central" } From 833cf52ca084ee682eb0677c7acb7138335fee34 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 26 Nov 2014 18:33:31 -0800 Subject: [PATCH 121/121] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index b9df42700d3f..e4cc771c2bbe 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8dbb684a5493..c9d54c6757fb 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 873c870d9a52..ed387042d122 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 4ad2efdbab15..ad60eff4b4c5 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8dbb684a5493..c9d54c6757fb 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 64dcd537b2b9..34b089a0bcd5 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 3e63ca8dc3b2..48df4ae30519 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index cfba5536362e..e2e88be0e276 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 89c17096bb79..7641dc771582 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 4322fed33b3d..0e91c75bf87b 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 4e84f9a57b9b..583817be35ea 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - +