Skip to content

Commit

Permalink
Bug 1280362 - Define gczeal/quit in shell.js, out of browser.js, plus…
Browse files Browse the repository at this point in the history
… a few other minor changes. r=arai
  • Loading branch information
jswalden committed Jun 29, 2016
1 parent 0003db2 commit 6278a9a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
9 changes: 0 additions & 9 deletions js/src/tests/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ function gc()
}
}

function quit()
{
}

function options(aOptionName)
{
// return value of options() is a comma delimited list
Expand Down Expand Up @@ -276,11 +272,6 @@ function optionsInit() {
}
}

function gczeal(z)
{
SpecialPowers.setGCZeal(z);
}

function jsTestDriverBrowserInit()
{

Expand Down
35 changes: 32 additions & 3 deletions js/src/tests/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
var ReflectApply = global.Reflect.apply;
var StringPrototypeEndsWith = global.String.prototype.endsWith;

var runningInBrowser = typeof global.window !== "undefined";
if (runningInBrowser) {
// Certain cached functionality only exists (and is only needed) when
// running in the browser. Segregate that caching here.

var SpecialPowersSetGCZeal =
global.SpecialPowers ? global.SpecialPowers.setGCZeal : undefined;
}

/****************************
* GENERAL HELPER FUNCTIONS *
****************************/
Expand Down Expand Up @@ -148,6 +157,28 @@
"print function is pre-existing, either provided by the shell or " +
"the already-executed top-level browser.js");

var quit = global.quit;
if (typeof quit !== "function") {
// XXX There's something very strange about quit() in browser runs being a
// function that doesn't quit at all (!). We should get rid of quit()
// as an integral part of tests in favor of something else.
quit = function quit() {};
global.quit = quit;
}

var gczeal = global.gczeal;
if (typeof gczeal !== "function") {
if (typeof SpecialPowersSetGCZeal === "function") {
gczeal = function gczeal(z) {
SpecialPowersSetGCZeal(z);
};
} else {
gczeal = function() {}; // no-op if not available
}

global.gczeal = gczeal;
}

/******************************************************
* TEST METADATA EXPORTS (these are of dubious value) *
******************************************************/
Expand Down Expand Up @@ -242,8 +273,6 @@


var STATUS = "STATUS: ";
var SECT_PREFIX = 'Section ';
var SECT_SUFFIX = ' of test - ';

var gDelayTestDriverEnd = false;

Expand Down Expand Up @@ -349,7 +378,7 @@ function expectExitCode(n)
*/
function inSection(x)
{
return SECT_PREFIX + x + SECT_SUFFIX;
return "Section " + x + " of test - ";
}

/*
Expand Down

0 comments on commit 6278a9a

Please sign in to comment.