blob: 3c5eead445c75ba9db5e7159f1848deab5263520 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<script>
var jsTestIsAsync = true;
function getAsyncTaskScript()
{
return `(function() {
uiController.didEndScrollingCallback = function() { };
uiController.didEndScrollingCallback = undefined;
uiController.doAsyncTask(function() {
uiController.uiScriptComplete('async task complete');
});
})();`;
}
function getImmediateScript()
{
return `(function() {
return 'immediate script complete';
})();`;
}
var scriptResult;
function runTest()
{
description('Test that a second immediate UI script returns if an earlier script registered then unregistered a callback');
if (!window.testRunner) {
debug('This test requires testRunner');
return;
}
if (!testRunner.runUIScript) {
debug('This test requires runUIScript');
return;
}
testRunner.runUIScript(getAsyncTaskScript(), function(result) {
scriptResult = result;
shouldBeEqualToString('scriptResult', 'async task complete');
testRunner.runUIScript(getImmediateScript(), function(result) {
scriptResult = result;
shouldBeEqualToString('scriptResult', 'immediate script complete');
finishJSTest();
});
});
}
window.addEventListener('load', runTest, false);
</script>
</head>
<body>
<pre id="results"></pre>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>