Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/typoFixer.js

Issue 8788183: Detect and handle the case of our own typo correction extension being installed in parallel (Closed)
Patch Set: Created Nov. 15, 2012, 1:18 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/main.js ('K') | « lib/main.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/typoFixer.js
===================================================================
--- a/lib/typoFixer.js
+++ b/lib/typoFixer.js
@@ -12,27 +12,43 @@
let appIntegration = require("typoAppIntegration");
let netError = require("typoNetError");
-// Attach our handlers to all browser windows
-new WindowObserver(
+
+let typoWindowObserver = null;
+
+exports.attachWindowObserver = attachWindowObserver;
+function attachWindowObserver()
{
Wladimir Palant 2012/11/19 07:30:02 Please check whether the observer is already attac
- applyToWindow: function(window)
+ // Attach our handlers to all browser windows
+ typoWindowObserver = new WindowObserver(
{
- if (!appIntegration.isKnownWindow(window))
- return;
-
- netError.applyToWindow(window);
- appIntegration.applyToWindow(window, correctURL);
- },
+ applyToWindow: function(window)
+ {
+ if (!appIntegration.isKnownWindow(window))
+ return;
+
+ netError.applyToWindow(window);
+ appIntegration.applyToWindow(window, correctURL);
+ },
- removeFromWindow: function(window)
- {
- if (!appIntegration.isKnownWindow(window))
- return;
-
- netError.removeFromWindow(window);
- appIntegration.removeFromWindow(window);
- }
-});
+ removeFromWindow: function(window)
+ {
+ if (!appIntegration.isKnownWindow(window))
+ return;
+
+ netError.removeFromWindow(window);
+ appIntegration.removeFromWindow(window);
+ }
+ });
+}
+attachWindowObserver();
+
+exports.detachWindowObserver = detachWindowObserver;
+function detachWindowObserver()
+{
Wladimir Palant 2012/11/19 07:30:02 Please check whether the observer is already detac
+ // Detach our handlers from all browser windows
+ typoWindowObserver.shutdown();
+ typoWindowObserver = null;
+}
function parseURL(url)
{
« lib/main.js ('K') | « lib/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld