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

Unified Diff: options.js

Issue 8679008: Huge hack: Opera doesn`t fire an unload event, make sure we can deal with that (Closed)
Patch Set: Created Oct. 24, 2012, 8:48 a.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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -1,8 +1,24 @@
+// Opera hack: wrap onFilterChange to make sure it won't get called after page
+// unload (Opera doesn't fire the unload event).
+var origOnFilterChange = window.onFilterChange;
+window.onFilterChange = function()
+{
+ if (typeof document.createElement("dummy") === "undefined")
+ {
+ var event = document.createEvent("Events");
+ event.initEvent("unload", false, false);
+ window.dispatchEvent(event);
+ return undefined;
+ }
+ else
+ return origOnFilterChange.apply(this, arguments);
+}
+
var backgroundPage = opera.extension.bgProcess;
var require = backgroundPage.require;
with(require("filterClasses"))
{
this.Filter = Filter;
this.WhitelistFilter = WhitelistFilter;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld