Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Unified Diff: test/inspector/console/destroy-context-during-log.js

Issue 2432163004: Avoid using stale InspectedContext pointers (Closed)
Patch Set: Add tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/inspector/console/destroy-context-during-log.js
diff --git a/test/inspector/console/destroy-context-during-log.js b/test/inspector/console/destroy-context-during-log.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4c448257850c82e8f93991212803781b472babc
--- /dev/null
+++ b/test/inspector/console/destroy-context-during-log.js
@@ -0,0 +1,42 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const expression = `
+ Object.defineProperty(Object.prototype, 'RemoteObject', {
+ configurable: true,
+ set(v) {
+ delete Object.prototype.RemoteObject;
+ this.RemoteObject = v;
+
+ detachInspector();
+ setTimeout(function() {
+ // Attach the inspector again for the sake of establishing a
+ // communication channel with the frontend test runner.
+ attachInspector();
+ console.log("End of test");
+ }, 0);
+ },
+ });
+
+ // Before the whole script runs, the inspector is already attached.
+ // Re-attach the inspector and trigger the console API to make sure that the
+ // injected inspector script runs again (and triggers the above setter).
+ detachInspector();
+ attachInspector();
+ console.log("First inspector activity after attaching inspector");
+`;
+
+Protocol.Runtime.enable();
+Protocol.Runtime.evaluate({
+ expression,
kozy 2016/10/21 15:06:53 Looks suspicious, expression: expression?
robwu 2016/10/21 20:32:45 Nope, this is ES6 syntax. It is a shorthand for ex
kozy 2016/10/21 20:41:26 Thanks, For object literals we prefer ES5 syntax w
robwu 2016/10/21 20:47:36 Is this tribal knowledge, or is there a public cod
+ silent: true,
kozy 2016/10/21 15:06:53 You don't really need it and it'll hide exception
robwu 2016/10/21 20:32:45 Done.
+ returnByValue: false,
kozy 2016/10/21 15:06:53 it's false by default, you can just pass { express
robwu 2016/10/21 20:32:45 Done.
+});
+
+Protocol.Runtime.onConsoleAPICalled(function(result) {
+ InspectorTest.logObject(result.params.args[0]);
+ if (result.params.args[0].value == "End of test") {
+ InspectorTest.completeTest();
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698