| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/debugger-test.js"></script> |
| <script src="resources/script1.js"></script> |
| <script src="resources/script2.js"></script> |
| <script src="resources/script3.js"></script> |
| |
| <script> |
| |
| function test() |
| { |
| InspectorTest.runDebuggerTestSuite([ |
| function testSourceFramesCount(next) |
| { |
| var panel = WebInspector.panels.scripts; |
| var select = panel._navigator._filesSelectElement; |
| var sourceFrameCount = 0; |
| |
| InspectorTest.showScriptSource("source-frame-count.html", step2); |
| |
| function step2() |
| { |
| InspectorTest.showScriptSource("script1.js", step3); |
| } |
| |
| function step3() |
| { |
| InspectorTest.showScriptSource("script2.js", didShowScriptSources); |
| } |
| |
| function didShowScriptSources() |
| { |
| var alreadyShownURLs = {}; |
| function didCreateSourceFrame() |
| { |
| if (!alreadyShownURLs[this._uiSourceCode.originURL()]) |
| sourceFrameCount += 1; |
| alreadyShownURLs[this._uiSourceCode.originURL()] = true; |
| } |
| InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wasShown", didCreateSourceFrame, true); |
| InspectorTest.reloadPage(didReload); |
| } |
| |
| function didReload() |
| { |
| InspectorTest.showScriptSource("script3.js", didShowScriptSourceAgain); |
| } |
| |
| function didShowScriptSourceAgain() |
| { |
| InspectorTest.assertTrue(panel._editorContainer.visibleView._uiSourceCode.originURL().indexOf("script3.js") !== -1); |
| // There should be maximum 3 source frames shown: |
| // - first one is the first shown (first tab added) |
| // - second one is the last viewed ("script2.js") |
| // - third one is explicitly selected script3.js. |
| InspectorTest.assertEquals(true, sourceFrameCount <= 3, "too many source frames created after page reload"); |
| next(); |
| } |
| } |
| ]); |
| }; |
| |
| </script> |
| |
| <script> |
| function secondInlinedScriptInPage() |
| { |
| return 0; |
| } |
| </script> |
| |
| <script> |
| function thirdInlinedScriptInPage() |
| { |
| return 0; |
| } |
| </script> |
| |
| <script> |
| function fourthInlinedScriptInPage() |
| { |
| return 0; |
| } |
| </script> |
| |
| </head> |
| |
| <body onload="runTest()"> |
| <p>Tests that scripts panel does not create too many source frames.</p> |
| |
| </body> |
| </html> |