| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| (async function() { |
| TestRunner.addResult(`Tests that scripts list is cleared upon page reload.\n`); |
| await TestRunner.loadModule('sources_test_runner'); |
| await TestRunner.showPanel('sources'); |
| |
| TestRunner.evaluateInPage('function foo() {} //# sourceURL=dummyScript.js', step1); |
| |
| function step1() { |
| SourcesTestRunner.startDebuggerTest(step2); |
| } |
| |
| function step2() { |
| SourcesTestRunner.queryScripts(function(script) { |
| step3({data: script}); |
| }); |
| TestRunner.debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource, step3); |
| } |
| |
| function step3(event) { |
| var script = event.data; |
| if (script.sourceURL.indexOf('dummyScript.js') !== -1) { |
| TestRunner.addResult('Dummy script found: ' + script.sourceURL); |
| // Let scripts dispatch and reload. |
| setTimeout(TestRunner.reloadPage.bind(TestRunner, afterReload), 0); |
| } |
| } |
| |
| function afterReload() { |
| var scripts = SourcesTestRunner.queryScripts(); |
| for (var i = 0; i < scripts.length; ++i) { |
| if (scripts[i].sourceURL.indexOf('dummyScript.js') !== -1) |
| TestRunner.addResult('FAILED: dummy script found after navigation'); |
| } |
| SourcesTestRunner.completeDebuggerTest(); |
| } |
| })(); |