mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Backed out changeset d4379d1513fd (bug 1272522) for failures in test_ext_alarms.html
This commit is contained in:
parent
413aa683aa
commit
60fc89ed14
@ -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");
|
||||
|
@ -9,7 +9,6 @@
|
||||
"sendAsyncMessage": false,
|
||||
|
||||
"waitForLoad": true,
|
||||
"promiseConsoleOutput": true,
|
||||
|
||||
"ExtensionTestUtils": false,
|
||||
"NetUtil": true,
|
||||
|
@ -1,6 +1,5 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
head.js
|
||||
file_download.html
|
||||
file_download.txt
|
||||
interruptible.sjs
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,7 @@
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<script type="text/javascript" src="test_constants.js"></script>
|
||||
<link rel="stylesheet" href="chrome://mochikit/contents/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
@ -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();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user