Commit 1349a914 authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Don't invalidate a GinPort's events if the context is already invalidated

A GinPort's onDisconnect may invalidate the context
(e.g. MessagingApiTest.MessagingBackgroundOnly). Attempting to
invalidate the events throws an exception which interferes with the
extensions JS testing framework.

Now the framework can call more of the safe builtins without triggering
the exception, so we do so here.

Bug: 803668
Change-Id: I07aa962ba689174a4f35885c72a9c3318256ff50
Reviewed-on: https://chromium-review.googlesource.com/c/1342068Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609821}
parent 88658b39
......@@ -242,6 +242,12 @@ void GinPort::OnContextInvalidated() {
}
void GinPort::InvalidateEvents(v8::Local<v8::Context> context) {
// No need to invalidate the events if the context itself was already
// invalidated; the APIEventHandler will have already cleaned up the
// listeners.
if (state_ == kInvalidated)
return;
// TODO(devlin): By calling GetEvent() here, we'll end up creating an event
// if one didn't exist. It would be more efficient to only invalidate events
// that the port has already created.
......
......@@ -94,7 +94,7 @@ binding.registerCustomHook(function(api) {
pendingCallbacks = 0;
lastTest = currentTest;
currentTest = chromeTest.tests.shift();
currentTest = $Array.shift(chromeTest.tests);
if (!currentTest) {
allTestsDone();
......@@ -107,7 +107,7 @@ binding.registerCustomHook(function(api) {
if (e !== failureException)
chromeTest.fail('uncaught exception: ' + message);
});
currentTest.call();
$Function.call(currentTest);
} catch (e) {
handleException(e.message, e);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment