-
Notifications
You must be signed in to change notification settings - Fork 343
/
getExternalSource.js
38 lines (35 loc) · 1.55 KB
/
getExternalSource.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Test for CompilationUnit#getSource(listener) for a JavaScript file external
* to its HTML file.
*/
function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/compilationunit/testScripts.html";
browser.addEventListener("onContextCreated", function(context)
{
FBTest.progress("getExternalSource, context created");
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.progress("getExternalSource, retrieving compilation units");
context.getCompilationUnits(function(units)
{
FBTest.progress("getExternalSource, compilation units retrieved");
var cuURL = FBTest.getHTTPURLBase()+"bti/compilationunit/simpleExternal.js";
unit = context.getCompilationUnit(cuURL);
FBTest.ok(unit, "compilation unit does not exist:" + cuURL);
unti.getSource(function(source)
{
FBTest.progress("getExternalSource, source retrieved");
FBTest.compare(source, "document.write(\"<p>Browser Tools Interface " +
"(external source file)<br>\");\r\ndocument.write(\"Another line of " +
"text</p>\");", "incorrect source");
FBTest.testDone("done test #getExternalSource()");
});
});
});
FBTest.progress("getExternalSource, open test page "+url);
FBTest.openNewTab(url, function(win)
{
FBTest.progress("getExternalSource, new tab opened "+url);
});
}