Title: [145586] trunk/Tools
- Revision
- 145586
- Author
- [email protected]
- Date
- 2013-03-12 14:47:23 -0700 (Tue, 12 Mar 2013)
Log Message
Cleanup: Move loading complete function into callback, rather than global.
https://bugs.webkit.org/show_bug.cgi?id=112167
Reviewed by Dirk Pranke.
Stop calling global functions, pass in proper handler to Loader
constructor. Note that the callback is optional, as tests, and
some potential dashboards, do not need one.
* TestResultServer/static-dashboards/dashboard_base.js:
* TestResultServer/static-dashboards/loader.js:
(.):
* TestResultServer/static-dashboards/loader_unittests.js:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (145585 => 145586)
--- trunk/Tools/ChangeLog 2013-03-12 21:39:51 UTC (rev 145585)
+++ trunk/Tools/ChangeLog 2013-03-12 21:47:23 UTC (rev 145586)
@@ -1,3 +1,19 @@
+2013-03-12 Julie Parent <[email protected]>
+
+ Cleanup: Move loading complete function into callback, rather than global.
+ https://bugs.webkit.org/show_bug.cgi?id=112167
+
+ Reviewed by Dirk Pranke.
+
+ Stop calling global functions, pass in proper handler to Loader
+ constructor. Note that the callback is optional, as tests, and
+ some potential dashboards, do not need one.
+
+ * TestResultServer/static-dashboards/dashboard_base.js:
+ * TestResultServer/static-dashboards/loader.js:
+ (.):
+ * TestResultServer/static-dashboards/loader_unittests.js:
+
2013-03-12 Christophe Dumez <[email protected]>
[EFL][WK2] Add popup menu support to MiniBrowser
Modified: trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js (145585 => 145586)
--- trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js 2013-03-12 21:39:51 UTC (rev 145585)
+++ trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js 2013-03-12 21:47:23 UTC (rev 145586)
@@ -440,11 +440,6 @@
return string.endsWith(window.location.pathname, 'flakiness_dashboard.html');
}
-function resourceLoadingComplete()
-{
- handleLocationChange();
-}
-
function handleLocationChange()
{
if (!g_resourceLoader.isLoadingComplete())
@@ -645,6 +640,6 @@
}
window.addEventListener('load', function() {
- g_resourceLoader = new loader.Loader();
+ g_resourceLoader = new loader.Loader(handleLocationChange);
g_resourceLoader.load();
}, false);
Modified: trunk/Tools/TestResultServer/static-dashboards/loader.js (145585 => 145586)
--- trunk/Tools/TestResultServer/static-dashboards/loader.js 2013-03-12 21:39:51 UTC (rev 145585)
+++ trunk/Tools/TestResultServer/static-dashboards/loader.js 2013-03-12 21:47:23 UTC (rev 145586)
@@ -57,7 +57,7 @@
xhr.send();
}
-loader.Loader = function()
+loader.Loader = function(opt_onLoadingComplete)
{
this._loadingSteps = [
this._loadBuildersList,
@@ -69,7 +69,7 @@
this._staleBuilders = [];
this._loadingComplete = false;
this._errors = new ui.Errors();
-
+ this._onLoadingComplete = opt_onLoadingComplete || function() {};
}
loader.Loader.prototype = {
@@ -91,10 +91,7 @@
if (!loadingStep) {
this._loadingComplete = true;
this._addErrors();
- // FIXME(jparent): Loader should not know about global
- // functions, should use a callback or dispatch load
- // event instead.
- resourceLoadingComplete();
+ this._onLoadingComplete();
return;
}
loadingStep.apply(this);
Modified: trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js (145585 => 145586)
--- trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js 2013-03-12 21:39:51 UTC (rev 145585)
+++ trunk/Tools/TestResultServer/static-dashboards/loader_unittests.js 2013-03-12 21:47:23 UTC (rev 145586)
@@ -31,7 +31,11 @@
test('loading steps', 1, function() {
resetGlobals();
var loadedSteps = [];
- var resourceLoader = new loader.Loader();
+ var loadingCompleteCallback = handleLocationChange;
+ handleLocationChange = function() {
+ deepEqual(loadedSteps, ['step 1', 'step 2']);
+ }
+ var resourceLoader = new loader.Loader(handleLocationChange);
function loadingStep1() {
loadedSteps.push('step 1');
resourceLoader.load();
@@ -41,16 +45,11 @@
resourceLoader.load();
}
- var loadingCompleteCallback = resourceLoadingComplete;
- resourceLoadingComplete = function() {
- deepEqual(loadedSteps, ['step 1', 'step 2']);
- }
-
try {
resourceLoader._loadingSteps = [loadingStep1, loadingStep2];
resourceLoader.load();
} finally {
- resourceLoadingComplete = loadingCompleteCallback;
+ handleLocationChange = loadingCompleteCallback;
}
});
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes