3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
5 <script src=
"../debugger/resources/script1.js"></script>
6 <script src=
"../debugger/resources/script2.js"></script>
7 <script src=
"../debugger/resources/script3.js"></script>
13 InspectorTest
.runDebuggerTestSuite([
14 function testSourceFramesCount(next
)
16 var panel
= WebInspector
.panels
.sources
;
17 var sourceFrameCount
= 0;
19 InspectorTest
.showScriptSource("source-frame-count.html", step2
);
23 InspectorTest
.showScriptSource("script1.js", step3
);
28 InspectorTest
.showScriptSource("script2.js", didShowScriptSources
);
31 function didShowScriptSources()
33 var alreadyShownURLs
= {};
34 function didCreateSourceFrame()
36 if (!alreadyShownURLs
[this._uiSourceCode
.originURL()])
37 sourceFrameCount
+= 1;
38 alreadyShownURLs
[this._uiSourceCode
.originURL()] = true;
40 InspectorTest
.addSniffer(WebInspector
.SourceFrame
.prototype, "wasShown", didCreateSourceFrame
, true);
41 InspectorTest
.reloadPage(didReload
);
46 InspectorTest
.showScriptSource("script3.js", didShowScriptSourceAgain
);
49 function didShowScriptSourceAgain()
51 InspectorTest
.assertTrue(panel
.visibleView
._uiSourceCode
.originURL().indexOf("script3.js") !== -1);
52 // There should be maximum 3 source frames shown:
53 // - first one is the first shown (first tab added)
54 // - second one is the last viewed ("script2.js")
55 // - third one is explicitly selected script3.js.
56 InspectorTest
.assertEquals(true, sourceFrameCount
<= 3, "too many source frames created after page reload");
66 function secondInlinedScriptInPage()
73 function thirdInlinedScriptInPage()
80 function fourthInlinedScriptInPage()
88 <body onload=
"runTest()">
89 <p>Tests that scripts panel does not create too many source frames.
</p>