Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Bug 820438 - Immediately apply changes in maximum script runtime to m…
Browse files Browse the repository at this point in the history
…ake them visible in content processes. r=jst, a=lsblakk
  • Loading branch information
gabrielesvelto committed Jan 31, 2013
1 parent 7e036c1 commit 12c3583
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 0 additions & 2 deletions b2g/app/b2g.js
Expand Up @@ -180,8 +180,6 @@ pref("content.sink.perf_parse_time", 50000000);

// Maximum scripts runtime before showing an alert
pref("dom.max_chrome_script_run_time", 0); // disable slow script dialog for chrome
// Bug 817230 - disable the dialog until we implement its checkbox properly
pref("dom.max_script_run_time", 0);

// plugins
pref("plugin.disable", true);
Expand Down
15 changes: 11 additions & 4 deletions dom/base/nsJSEnvironment.cpp
Expand Up @@ -132,6 +132,9 @@ static PRLogModuleInfo* gJSDiagnostics;

#define JAVASCRIPT nsIProgrammingLanguage::JAVASCRIPT

// Large value used to specify that a script should run essentially forever
#define NS_UNLIMITED_SCRIPT_RUNTIME LL_INIT(0x40000000, 0)

// if you add statics here, add them to the list in nsJSRuntime::Startup

static nsITimer *sGCTimer;
Expand Down Expand Up @@ -888,8 +891,13 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
// Allow the script to continue running

if (neverShowDlgChk) {
Preferences::SetInt(isTrackingChromeCodeTime ?
"dom.max_chrome_script_run_time" : "dom.max_script_run_time", 0);
if (isTrackingChromeCodeTime) {
Preferences::SetInt("dom.max_chrome_script_run_time", 0);
sMaxChromeScriptRunTime = NS_UNLIMITED_SCRIPT_RUNTIME;
} else {
Preferences::SetInt("dom.max_script_run_time", 0);
sMaxScriptRunTime = NS_UNLIMITED_SCRIPT_RUNTIME;
}
}

ctx->mOperationCallbackTime = PR_Now();
Expand Down Expand Up @@ -3779,8 +3787,7 @@ MaxScriptRunTimePrefChangedCallback(const char *aPrefName, void *aClosure)

PRTime t;
if (time <= 0) {
// Let scripts run for a really, really long time.
t = LL_INIT(0x40000000, 0);
t = NS_UNLIMITED_SCRIPT_RUNTIME;
} else {
t = time * PR_USEC_PER_SEC;
}
Expand Down

0 comments on commit 12c3583

Please sign in to comment.