1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 00:10:57 +01:00

Fix countdown embeds and endless loops on resource loads in Javelin

Summary:
Fixes T5273. Two issues:

  - If a JX.Resource callback throws, we keep running it. Instead, make sure it gets cleaned up before raising an exception.
  - The countdown timer script doesn't recover gracefully if the node has been removed from the document by the time it runs. Instead, just bail if we can't find the countdown.

Test Plan: Dumped `{Cxyz}` into a preview and got a countdown.

Reviewers: yungsters

Reviewed By: yungsters

Subscribers: epriestley

Maniphest Tasks: T5273

Differential Revision: https://secure.phabricator.com/D9399
This commit is contained in:
epriestley 2014-06-05 17:16:36 -07:00
parent fcc2a24d63
commit d06679a021
3 changed files with 30 additions and 16 deletions

View file

@ -8,7 +8,7 @@ return array(
'names' =>
array(
'core.pkg.css' => 'd9c53a92',
'core.pkg.js' => 'd7e1141d',
'core.pkg.js' => '9c9c8442',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '4a93db37',
'differential.pkg.js' => 'eca39a2c',
@ -198,7 +198,7 @@ return array(
'rsrc/externals/javelin/lib/JSON.js' => '08e56a4e',
'rsrc/externals/javelin/lib/Mask.js' => 'b9f26029',
'rsrc/externals/javelin/lib/Request.js' => '7bad574b',
'rsrc/externals/javelin/lib/Resource.js' => '356de121',
'rsrc/externals/javelin/lib/Resource.js' => '0f81f8df',
'rsrc/externals/javelin/lib/Routable.js' => 'b3e7d692',
'rsrc/externals/javelin/lib/Router.js' => '29274e2b',
'rsrc/externals/javelin/lib/URI.js' => 'd9a9b862',
@ -343,7 +343,7 @@ return array(
'rsrc/js/application/conpherence/behavior-menu.js' => '7ee23816',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '53f6f2dd',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '40b1ff90',
'rsrc/js/application/countdown/timer.js' => '889c96f3',
'rsrc/js/application/countdown/timer.js' => '361e3ed3',
'rsrc/js/application/dashboard/behavior-dashboard-async-panel.js' => '469c0d9e',
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'fa187a68',
'rsrc/js/application/differential/ChangesetViewManager.js' => 'db09a523',
@ -542,7 +542,7 @@ return array(
'javelin-behavior-conpherence-menu' => '7ee23816',
'javelin-behavior-conpherence-pontificate' => '53f6f2dd',
'javelin-behavior-conpherence-widget-pane' => '40b1ff90',
'javelin-behavior-countdown-timer' => '889c96f3',
'javelin-behavior-countdown-timer' => '361e3ed3',
'javelin-behavior-dark-console' => 'e9fdb5e5',
'javelin-behavior-dashboard-async-panel' => '469c0d9e',
'javelin-behavior-dashboard-move-panels' => 'fa187a68',
@ -652,7 +652,7 @@ return array(
'javelin-reactor-node-calmer' => '76f4ebed',
'javelin-reactornode' => 'b4c30592',
'javelin-request' => '7bad574b',
'javelin-resource' => '356de121',
'javelin-resource' => '0f81f8df',
'javelin-routable' => 'b3e7d692',
'javelin-router' => '29274e2b',
'javelin-stratcom' => 'c293f7b9',
@ -902,6 +902,12 @@ return array(
0 => 'javelin-install',
1 => 'javelin-util',
),
'0f81f8df' =>
array(
0 => 'javelin-util',
1 => 'javelin-uri',
2 => 'javelin-install',
),
'127f2018' =>
array(
0 => 'javelin-behavior',
@ -1058,11 +1064,10 @@ return array(
3 => 'javelin-stratcom',
4 => 'javelin-request',
),
'356de121' =>
'361e3ed3' =>
array(
0 => 'javelin-util',
1 => 'javelin-uri',
2 => 'javelin-install',
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
'37871df4' =>
array(
@ -1455,11 +1460,6 @@ return array(
5 => 'javelin-util',
6 => 'javelin-stratcom',
),
'889c96f3' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
'8a3ed18b' =>
array(
0 => 'javelin-magical-init',

View file

@ -135,14 +135,23 @@ JX.install('Resource', {
delete JX.Resource._loading[uri];
JX.Resource._loaded[uri] = true;
var errors = [];
for (ii = 0; ii < list.length; ii++) {
current = list[ii];
delete current.resources[uri];
if (!JX.Resource._hasResources(current.resources)) {
current.callback();
try {
current.callback();
} catch (error) {
errors.push(error);
}
list.splice(ii--, 1);
}
}
if (errors.length) {
throw errors[0];
}
},
_hasResources: function(resources) {

View file

@ -6,7 +6,12 @@
JX.behavior('countdown-timer', function(config) {
var container = JX.$(config.container);
try {
var container = JX.$(config.container);
} catch (ignored) {
return;
}
calculateTimeLeft();
function setComponent(which, content) {