Bug 1342215 - Fix pageError stub generation. r=jdescottes
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Thu, 23 Feb 2017 22:02:52 +0100
changeset 373710 647cbb760050200a9e0c810acf23541c98f0f5ca
parent 373600 c7935d540027158ef1bf8e1c0e69af6b2eb9df93
child 373711 757d5ee3dbc38876d9c207857ab239d55e26a6dd
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1342215
milestone54.0a1
Bug 1342215 - Fix pageError stub generation. r=jdescottes We set a listener for "pageError" but we don't remove it. There is a `once: true` property passed as an option for addListener, but this isn't a standard addEventListener call it does not do anything. Reverting to remove the listener fix the issue. MozReview-Commit-ID: CrpS1QY5jNo
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
--- a/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
@@ -408,22 +408,21 @@ function* generatePageErrorStubs() {
     packets: [],
   };
 
   let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
 
   for (let [key, code] of pageError) {
     let received = new Promise(resolve => {
       toolbox.target.client.addListener("pageError", function onPacket(e, packet) {
+        toolbox.target.client.removeListener("pageError", onPacket);
         let message = prepareMessage(packet, {getNextId: () => 1});
         stubs.packets.push(formatPacket(message.messageText, packet));
         stubs.preparedMessages.push(formatStub(message.messageText, packet));
         resolve();
-      }, {
-        once: true
       });
     });
 
     yield ContentTask.spawn(
       gBrowser.selectedBrowser,
       [key, code],
       function ([subKey, subCode]) {
         let script = content.document.createElement("script");