Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Commit

Permalink
Work around script caching in newer Geckos.
Browse files Browse the repository at this point in the history
  • Loading branch information
bard committed Nov 3, 2011
1 parent 81a55bb commit cb151c0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion chrome/content/repl.js
Expand Up @@ -50,6 +50,8 @@ const srvPref = Cc['@mozilla.org/preferences-service;1']
var util = {};
loader.loadSubScript('chrome://mozrepl/content/util.js', util);

const DEBUG = false;


// CORE
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -580,6 +582,8 @@ var javascriptInteractor = {
},

handleInput: function(repl, input) {
debug('input', input);

if(input.match(/^\s*$/) && this._inputBuffer.match(/^\s*$/)) {
repl._prompt();
return;
Expand Down Expand Up @@ -853,6 +857,11 @@ function receive(input) {
// UTILITIES
// ----------------------------------------------------------------------

function debug() {
if(DEBUG)
dump('MOZREPL :: DEBUG :: ' + Array.prototype.slice.call(arguments).join(' :: ') + '\n');
}

function formatStackTrace(exception) {
var trace = '';
if(exception.stack) {
Expand Down Expand Up @@ -898,6 +907,8 @@ function scan(string, separator) {
}

function evaluate(code) {
debug('evaluate', code);

var _ = arguments.callee;
if(typeof(_.TMP_FILE) == 'undefined') {
_.TMP_FILE = Cc['@mozilla.org/file/directory_service;1']
Expand All @@ -922,7 +933,11 @@ function evaluate(code) {
os.writeString(code);
os.close();

var result = loader.loadSubScript(_.TMP_FILE_URL, this._workContext);
if(typeof(_.cacheKiller) == 'undefined')
_.cacheKiller = 0;

_.cacheKiller++;
var result = loader.loadSubScript(_.TMP_FILE_URL + '?' + _.cacheKiller, this._workContext);

this.$$ = result;
return result;
Expand Down

0 comments on commit cb151c0

Please sign in to comment.