2016-10-26 20:26:56 +00:00
|
|
|
// 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.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Tests that destroying context from inside of console.log does not crash');
|
|
|
|
|
2016-10-26 20:26:56 +00:00
|
|
|
const expression = `
|
|
|
|
Object.defineProperty(Object.prototype, 'RemoteObject', {
|
|
|
|
configurable: true,
|
|
|
|
set(v) {
|
2017-03-24 01:33:12 +00:00
|
|
|
console.log("Should never be called");
|
2016-10-26 20:26:56 +00:00
|
|
|
delete Object.prototype.RemoteObject;
|
|
|
|
this.RemoteObject = v;
|
|
|
|
|
2017-05-18 23:11:20 +00:00
|
|
|
inspector.fireContextDestroyed();
|
2016-10-26 20:26:56 +00:00
|
|
|
setTimeout(function() {
|
|
|
|
// Attach the inspector again for the sake of establishing a
|
|
|
|
// communication channel with the frontend test runner.
|
2017-05-18 23:11:20 +00:00
|
|
|
inspector.fireContextCreated();
|
2016-10-26 20:26:56 +00:00
|
|
|
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).
|
2017-05-18 23:11:20 +00:00
|
|
|
inspector.fireContextDestroyed();
|
|
|
|
inspector.fireContextCreated();
|
2016-10-26 20:26:56 +00:00
|
|
|
console.log("First inspector activity after attaching inspector");
|
2017-03-24 01:33:12 +00:00
|
|
|
console.log("End of test");
|
2016-10-26 20:26:56 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
Protocol.Runtime.enable();
|
|
|
|
Protocol.Runtime.evaluate({ expression: expression });
|
|
|
|
|
|
|
|
Protocol.Runtime.onConsoleAPICalled(function(result) {
|
|
|
|
InspectorTest.logObject(result.params.args[0]);
|
|
|
|
if (result.params.args[0].value == "End of test") {
|
|
|
|
InspectorTest.completeTest();
|
|
|
|
}
|
|
|
|
});
|