v8/test/inspector/runtime/evaluate-without-side-effects.js
Erik Luo 0d2c85b70b [inspector] expose throwOnSideEffect for Runtime.evaluate
Bug: chromium:810176
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I16e4148434f5cbf44058e1aa5f01693bcba82d0a
Reviewed-on: https://chromium-review.googlesource.com/932943
Commit-Queue: Erik Luo <luoe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51640}
2018-02-28 23:54:46 +00:00

30 lines
1014 B
JavaScript

// Copyright 2018 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.
let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.evaluate can run without side effects.");
Protocol.Runtime.enable();
Protocol.Debugger.enable();
(async function() {
InspectorTest.log("Test throwOnSideEffect: false");
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
expression: "var x = 2; x;",
throwOnSideEffect: false
}));
InspectorTest.log("Test expression with side-effect, with throwOnSideEffect: true");
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
expression: "x = 3; x;",
throwOnSideEffect: true
}));
InspectorTest.log("Test expression without side-effect, with throwOnSideEffect: true");
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
expression: "x * 2",
throwOnSideEffect: true
}));
InspectorTest.completeTest();
})();