| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | |
| 5 <script src="resources/script1.js"></script> | |
| 6 <script src="resources/script2.js"></script> | |
| 7 <script src="resources/script3.js"></script> | |
| 8 | |
| 9 <script> | |
| 10 | |
| 11 function test() | |
| 12 { | |
| 13 InspectorTest.runDebuggerTestSuite([ | |
| 14 function testSourceFramesCount(next) | |
| 15 { | |
| 16 var panel = WebInspector.panels.sources; | |
| 17 var sourceFrameCount = 0; | |
| 18 | |
| 19 InspectorTest.showScriptSource("source-frame-count.html", step2); | |
| 20 | |
| 21 function step2() | |
| 22 { | |
| 23 InspectorTest.showScriptSource("script1.js", step3); | |
| 24 } | |
| 25 | |
| 26 function step3() | |
| 27 { | |
| 28 InspectorTest.showScriptSource("script2.js", didShowScriptSource
s); | |
| 29 } | |
| 30 | |
| 31 function didShowScriptSources() | |
| 32 { | |
| 33 var alreadyShownURLs = {}; | |
| 34 function didCreateSourceFrame() | |
| 35 { | |
| 36 if (!alreadyShownURLs[this._uiSourceCode.originURL()]) | |
| 37 sourceFrameCount += 1; | |
| 38 alreadyShownURLs[this._uiSourceCode.originURL()] = true; | |
| 39 } | |
| 40 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "wa
sShown", didCreateSourceFrame, true); | |
| 41 InspectorTest.reloadPage(didReload); | |
| 42 } | |
| 43 | |
| 44 function didReload() | |
| 45 { | |
| 46 InspectorTest.showScriptSource("script3.js", didShowScriptSource
Again); | |
| 47 } | |
| 48 | |
| 49 function didShowScriptSourceAgain() | |
| 50 { | |
| 51 InspectorTest.assertTrue(panel.visibleView._uiSourceCode.originU
RL().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 man
y source frames created after page reload"); | |
| 57 next(); | |
| 58 } | |
| 59 } | |
| 60 ]); | |
| 61 }; | |
| 62 | |
| 63 </script> | |
| 64 | |
| 65 <script> | |
| 66 function secondInlinedScriptInPage() | |
| 67 { | |
| 68 return 0; | |
| 69 } | |
| 70 </script> | |
| 71 | |
| 72 <script> | |
| 73 function thirdInlinedScriptInPage() | |
| 74 { | |
| 75 return 0; | |
| 76 } | |
| 77 </script> | |
| 78 | |
| 79 <script> | |
| 80 function fourthInlinedScriptInPage() | |
| 81 { | |
| 82 return 0; | |
| 83 } | |
| 84 </script> | |
| 85 | |
| 86 </head> | |
| 87 | |
| 88 <body onload="runTest()"> | |
| 89 <p>Tests that scripts panel does not create too many source frames.</p> | |
| 90 | |
| 91 </body> | |
| 92 </html> | |
| OLD | NEW |