www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit bdfbfc10b2d7384ef6d97a6c4d64a3cef2683f24
parent da6149b06fda43ae178255f05f7fa66559d38562
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 30 Jul 2012 02:37:39 -0400

Use methodjit...

Diffstat:
Mchrome/content/zotero/xpcom/http.js | 25+++++++++++++++++++++++--
Mresource/q.js | 7+++++--
2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js @@ -180,8 +180,10 @@ Zotero.HTTP = new function() { // Don't cache GET requests xmlhttp.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; + var useMethodjit = Components.utils.methodjit; /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, onDone, responseCharset); }; @@ -266,8 +268,10 @@ Zotero.HTTP = new function() { xmlhttp.setRequestHeader(header, headers[header]); } + var useMethodjit = Components.utils.methodjit; /** @ignore */ - xmlhttp.onreadystatechange = function(){ + xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, onDone, responseCharset); }; @@ -328,8 +332,10 @@ Zotero.HTTP = new function() { // Don't cache HEAD requests xmlhttp.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; + var useMethodjit = Components.utils.methodjit; /** @ignore */ - xmlhttp.onreadystatechange = function(){ + xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, onDone); }; @@ -364,8 +370,11 @@ Zotero.HTTP = new function() { // Prevent certificate/authentication dialogs from popping up xmlhttp.mozBackgroundRequest = true; xmlhttp.open('OPTIONS', uri.spec, true); + + var useMethodjit = Components.utils.methodjit; /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, callback); }; xmlhttp.send(null); @@ -436,7 +445,10 @@ Zotero.HTTP = new function() { xmlhttp.setRequestHeader("Content-Type", 'text/xml; charset="utf-8"'); + var useMethodjit = Components.utils.methodjit; + /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, callback); }; @@ -469,7 +481,10 @@ Zotero.HTTP = new function() { // Prevent certificate/authentication dialogs from popping up xmlhttp.mozBackgroundRequest = true; xmlhttp.open('MKCOL', uri.spec, true); + var useMethodjit = Components.utils.methodjit; + /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, callback); }; xmlhttp.send(null); @@ -511,7 +526,10 @@ Zotero.HTTP = new function() { // with Content-Length: 0, which triggers a "no element found" error // in Firefox, so we override to text xmlhttp.overrideMimeType("text/plain"); + var useMethodjit = Components.utils.methodjit; + /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, callback); }; xmlhttp.send(body); @@ -547,7 +565,10 @@ Zotero.HTTP = new function() { // Firefox 3 throws a "no element found" error even with a // 204 ("No Content") response, so we override to text xmlhttp.overrideMimeType("text/plain"); + var useMethodjit = Components.utils.methodjit; + /** @ignore */ xmlhttp.onreadystatechange = function() { + Components.utils.methodjit = useMethodjit; _stateChange(xmlhttp, callback); }; xmlhttp.send(null); diff --git a/resource/q.js b/resource/q.js @@ -97,9 +97,12 @@ var _runningTimers = []; return function setTimeout(func, ms) { - var timer = Components.classes["@mozilla.org/timer;1"]. - createInstance(Components.interfaces.nsITimer); + var useMethodjit = Components.utils.methodjit, + timer = Components.classes["@mozilla.org/timer;1"]. + createInstance(Components.interfaces.nsITimer); timer.initWithCallback({"notify":function() { + Components.utils.methodjit = useMethodjit; + // Remove timer from array so it can be garbage collected _runningTimers.splice(_runningTimers.indexOf(timer), 1);