diff options
author | Trevor Elliott <trevor@galois.com> | 2013-06-17 17:17:09 -0700 |
---|---|---|
committer | Trevor Elliott <trevor@galois.com> | 2013-06-17 17:24:54 -0700 |
commit | 8316c65b174e881433721382e0214cec2412ae6b (patch) | |
tree | e3c1c00b1ebbb1578218104ebf752028d23927a3 /src/js/fiveui/js | |
parent | 7a4a58de847fd2ebe50c30e4874eea4c057c065f (diff) |
Fix a funny bug that caused a closed port to be used
Diffstat (limited to 'src/js/fiveui/js')
-rw-r--r-- | src/js/fiveui/js/background.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/js/fiveui/js/background.js b/src/js/fiveui/js/background.js index c52aca8..dfe0649 100644 --- a/src/js/fiveui/js/background.js +++ b/src/js/fiveui/js/background.js @@ -50,6 +50,12 @@ fiveui.Background = function(settings, updateWidget, loadScripts, dataLoader) { this.dataLoader = dataLoader; }; +/** + * NOTE: As compute nodes get injected first, there's a chance that if send + * ReportProblem or ReportStats too early, the uiPort element of the tabState + * might not be setup yet. This will cause some strange problems, and we should + * consider reversing the order that the injection happens in. + */ fiveui.Background.prototype._registerComputeListeners = function(port, tabState){ var bg = this; port.on('ReportProblem', function(request) { @@ -134,6 +140,9 @@ fiveui.Background.prototype.pageLoad = function(tabId, url, data) { this.updateWidget(null); } else { var tabState = this.state.acquireTabState(tabId); + + // clear out old ports + tabState.uiPort = null; tabState.computePorts = []; this.updateWidget(tabState); |