From 60fc89ed14dd3663ea1c511e9f28935b5bf52d1f Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 4 Jul 2016 06:25:51 +0200 Subject: [PATCH] Backed out changeset d4379d1513fd (bug 1272522) for failures in test_ext_alarms.html --- .../components/extensions/NativeMessaging.jsm | 28 ------------ .../extensions/test/mochitest/.eslintrc | 1 - .../extensions/test/mochitest/chrome.ini | 1 - .../extensions/test/mochitest/head.js | 32 +------------- .../test_chrome_ext_native_messaging.html | 43 +------------------ 5 files changed, 2 insertions(+), 103 deletions(-) diff --git a/toolkit/components/extensions/NativeMessaging.jsm b/toolkit/components/extensions/NativeMessaging.jsm index 5ff4a56ed99f..5bd02d85044b 100644 --- a/toolkit/components/extensions/NativeMessaging.jsm +++ b/toolkit/components/extensions/NativeMessaging.jsm @@ -194,7 +194,6 @@ this.NativeApp = class extends EventEmitter { command: hostInfo.manifest.path, arguments: [hostInfo.path], workdir: OS.Path.dirname(hostInfo.manifest.path), - stderr: "pipe", }; return Subprocess.call(subprocessOpts); }).then(proc => { @@ -202,7 +201,6 @@ this.NativeApp = class extends EventEmitter { this.proc = proc; this._startRead(); this._startWrite(); - this._startStderrRead(); }).catch(err => { this.startupPromise = null; Cu.reportError(err.message); @@ -262,32 +260,6 @@ this.NativeApp = class extends EventEmitter { }); } - _startStderrRead() { - let proc = this.proc; - let app = this.name; - Task.spawn(function* () { - let partial = ""; - while (true) { - let data = yield proc.stderr.readString(); - if (data.length == 0) { - // We have hit EOF, just stop reading - if (partial) { - Services.console.logStringMessage(`stderr output from native app ${app}: ${partial}`); - } - break; - } - - let lines = data.split(/\r?\n/); - lines[0] = partial + lines[0]; - partial = lines.pop(); - - for (let line of lines) { - Services.console.logStringMessage(`stderr output from native app ${app}: ${line}`); - } - } - }); - } - send(msg) { if (this._isDisconnected) { throw new this.context.cloneScope.Error("Attempt to postMessage on disconnected port"); diff --git a/toolkit/components/extensions/test/mochitest/.eslintrc b/toolkit/components/extensions/test/mochitest/.eslintrc index 47e982ecbd37..93c336db0f5b 100644 --- a/toolkit/components/extensions/test/mochitest/.eslintrc +++ b/toolkit/components/extensions/test/mochitest/.eslintrc @@ -9,7 +9,6 @@ "sendAsyncMessage": false, "waitForLoad": true, - "promiseConsoleOutput": true, "ExtensionTestUtils": false, "NetUtil": true, diff --git a/toolkit/components/extensions/test/mochitest/chrome.ini b/toolkit/components/extensions/test/mochitest/chrome.ini index 7e23f8bf80fe..916b520a8242 100644 --- a/toolkit/components/extensions/test/mochitest/chrome.ini +++ b/toolkit/components/extensions/test/mochitest/chrome.ini @@ -1,6 +1,5 @@ [DEFAULT] support-files = - head.js file_download.html file_download.txt interruptible.sjs diff --git a/toolkit/components/extensions/test/mochitest/head.js b/toolkit/components/extensions/test/mochitest/head.js index bde9865f4a57..c0fffa06a4d2 100644 --- a/toolkit/components/extensions/test/mochitest/head.js +++ b/toolkit/components/extensions/test/mochitest/head.js @@ -1,8 +1,6 @@ "use strict"; -Components.utils.import("resource://gre/modules/Task.jsm"); - -/* exported waitForLoad, promiseConsoleOutput */ +/* exported waitForLoad */ function waitForLoad(win) { return new Promise(resolve => { @@ -12,31 +10,3 @@ function waitForLoad(win) { }, true); }); } - -var promiseConsoleOutput = Task.async(function* (task) { - const DONE = "=== extension test console listener done ==="; - - let listener; - let messages = []; - let awaitListener = new Promise(resolve => { - listener = msg => { - if (msg == DONE) { - resolve(); - } else if (msg instanceof Ci.nsIConsoleMessage) { - messages.push(msg.message); - } - }; - }); - - Services.console.registerListener(listener); - try { - let result = yield task(); - - Services.console.logStringMessage(DONE); - yield awaitListener; - - return {messages, result}; - } finally { - Services.console.unregisterListener(listener); - } -}); diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html index 163c979009f0..193f8567a4f5 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html @@ -6,6 +6,7 @@ + @@ -95,14 +96,6 @@ while True: sys.stdout.write(msg) `; -const STDERR_LINES = ["hello stderr", "this should be a separate line"]; -const STDERR_MSG = STDERR_LINES.join("\\n"); - -const STDERR_BODY = String.raw` -import sys -sys.stderr.write("${STDERR_MSG}") -`; - const SCRIPTS = [ { name: "echo", @@ -119,11 +112,6 @@ const SCRIPTS = [ description: "a native app that does not exit when stdin closes or on SIGTERM", script: WONTDIE_BODY, }, - { - name: "stderr", - description: "a native app that writes to stderr and then exits", - script: STDERR_BODY, - }, ]; add_task(function* setup() { @@ -580,35 +568,6 @@ add_task(function* test_unresponsive_native_app() { is(procCount, 0, "subprocess was succesfully killed"); }); -add_task(function* test_stderr() { - function background() { - let port = browser.runtime.connectNative("stderr"); - port.onDisconnect.addListener(() => { - browser.test.sendMessage("finished"); - }); - } - - let {messages} = yield promiseConsoleOutput(function* () { - let extension = ExtensionTestUtils.loadExtension({ - background: `(${background})()`, - manifest: { - permissions: ["nativeMessaging"], - }, - }, ID); - - yield extension.startup(); - yield extension.awaitMessage("finished"); - yield extension.unload(); - }); - - let lines = STDERR_LINES.map(line => messages.findIndex(msg => msg.includes(line))); - isnot(lines[0], -1, "Saw first line of stderr output on the console"); - isnot(lines[1], -1, "Saw second line of stderr output on the console"); - isnot(lines[0], lines[1], "Stderr output lines are separated in the console"); - - yield waitForSubprocessExit(); -}); -