Bug 1439788 - Add performance.now() function to JS shell. r=arai

--HG--
extra : rebase_source : ac2642afd1fd76909d690b51eb62035c5d77ee92
This commit is contained in:
Dhi Aurrahman 2018-03-03 18:01:45 +07:00
Родитель f4757bccc2
Коммит e4460fcc51
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -7457,6 +7457,14 @@ TestAssertRecoveredOnBailout,
JS_FS_HELP_END
};
static const JSFunctionSpecWithHelp performance_functions[] = {
JS_FN_HELP("now", Now, 0, 0,
"now()",
" Return the current time with sub-ms precision.\n"
" This function is an alias of the dateNow() function."),
JS_FS_HELP_END
};
static const JSFunctionSpecWithHelp console_functions[] = {
JS_FN_HELP("log", Print, 0, 0,
"log([exp ...])",
@ -8385,6 +8393,8 @@ NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
RootedObject performanceObj(cx, JS_NewObject(cx, nullptr));
if (!performanceObj)
return nullptr;
if (!JS_DefineFunctionsWithHelp(cx, performanceObj, performance_functions))
return nullptr;
RootedObject mozMemoryObj(cx, JS_NewObject(cx, nullptr));
if (!mozMemoryObj)
return nullptr;