Bug 1543458 - Perform non-inflating syntactic UTF-8 compilation in jsapi-tests. r=arai

Differential Revision: https://phabricator.services.mozilla.com/D26954

--HG--
extra : rebase_source : 110ce637549a620d428a6aef8bbdd28efd6276ca
This commit is contained in:
Jeff Walden 2019-04-10 09:08:53 -07:00
Родитель 3a9a35b609
Коммит 9b200d1b43
9 изменённых файлов: 25 добавлений и 25 удалений

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

@ -5,7 +5,7 @@
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
#include "gc/GCInternals.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile{,ForNonSyntacticScope}
#include "js/CompilationAndEvaluation.h" // JS::Compile{,DontInflate,ForNonSyntacticScope}
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "jsapi-tests/tests.h"
#include "vm/Monitor.h"
@ -95,7 +95,7 @@ bool testCompile(bool nonSyntactic) {
CHECK(script);
CHECK_EQUAL(script->hasNonSyntacticScope(), nonSyntactic);
script = Compile(cx, options, buf8);
script = CompileDontInflate(cx, options, buf8);
CHECK(script);
CHECK_EQUAL(script->hasNonSyntacticScope(), nonSyntactic);

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

@ -11,7 +11,7 @@
#include "jsfriendapi.h"
#include "js/CharacterEncoding.h"
#include "js/CompilationAndEvaluation.h"
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/SourceText.h"
#include "jsapi-tests/tests.h"
#include "vm/ErrorReporting.h"

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

@ -11,7 +11,7 @@
#include "jsfriendapi.h"
#include "js/CharacterEncoding.h"
#include "js/CompilationAndEvaluation.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile{,DontInflate}
#include "js/SourceText.h"
#include "jsapi-tests/tests.h"
#include "vm/ErrorReporting.h"

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

@ -9,7 +9,7 @@
#include "jspubtd.h"
#include "gc/Heap.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "jsapi-tests/tests.h"
@ -29,7 +29,7 @@ BEGIN_TEST(testGCCellPtr) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, code, strlen(code), JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, opts, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, opts, srcBuf));
CHECK(script);
CHECK(!JS::GCCellPtr(nullptr));

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

@ -10,7 +10,7 @@
#include "jsapi.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/HeapAPI.h"
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "jsapi-tests/tests.h"
@ -50,7 +50,7 @@ BEGIN_TEST(testPrivateGCThingValue) {
CHECK(srcBuf.init(cx, code, mozilla::ArrayLength(code) - 1,
JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
JS_SetReservedSlot(obj, 0, PrivateGCThingValue(script));

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

@ -10,7 +10,7 @@
#include "jsapi.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "jsapi-tests/tests.h"
@ -38,7 +38,7 @@ BEGIN_TEST(testScriptInfo) {
CHECK(srcBuf.init(cx, code, mozilla::ArrayLength(code) - 1,
JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
CHECK_EQUAL(JS_GetScriptBaseLineNumber(cx, script), startLine);

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

@ -7,7 +7,7 @@
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
#include "js/CompilationAndEvaluation.h" // JS::Compile{,Utf8{Path,File}}
#include "js/CompilationAndEvaluation.h" // JS::Compile{,DontInflate,Utf8{Path,File}}
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "jsapi-tests/tests.h"
@ -48,7 +48,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, code, code_size, JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
return tryScript(script);
@ -62,7 +62,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript_empty) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, "", 0, JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
return tryScript(script);
@ -76,7 +76,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScriptForPrincipals) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, code, code_size, JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
return tryScript(script);
}
@ -223,7 +223,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, CloneAndExecuteScript) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, "val", 3, JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
JS::RootedValue value(cx);

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

@ -5,7 +5,7 @@
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
#include "builtin/TestingFunctions.h"
#include "js/CompilationAndEvaluation.h" // JS::Compile
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "js/UbiNode.h"
#include "js/UbiNodeDominatorTree.h"
@ -98,7 +98,7 @@ BEGIN_TEST(test_ubiNodeZone) {
JS::SourceText<mozilla::Utf8Unit> emptySrcBuf;
CHECK(emptySrcBuf.init(cx, "", 0, JS::SourceOwnership::Borrowed));
RootedScript script1(cx, JS::Compile(cx, options, emptySrcBuf));
RootedScript script1(cx, JS::CompileDontInflate(cx, options, emptySrcBuf));
CHECK(script1);
{
@ -109,7 +109,7 @@ BEGIN_TEST(test_ubiNodeZone) {
RootedString string2(cx,
JS_NewStringCopyZ(cx, "A million household uses!"));
CHECK(string2);
RootedScript script2(cx, JS::Compile(cx, options, emptySrcBuf));
RootedScript script2(cx, JS::CompileDontInflate(cx, options, emptySrcBuf));
CHECK(script2);
CHECK(JS::ubi::Node(string1).zone() == global1->zone());
@ -147,7 +147,7 @@ BEGIN_TEST(test_ubiNodeCompartment) {
CHECK(emptySrcBuf.init(cx, "", 0, JS::SourceOwnership::Borrowed));
// Create a script in the original realm...
RootedScript script1(cx, JS::Compile(cx, options, emptySrcBuf));
RootedScript script1(cx, JS::CompileDontInflate(cx, options, emptySrcBuf));
CHECK(script1);
{
@ -155,7 +155,7 @@ BEGIN_TEST(test_ubiNodeCompartment) {
// there, too.
JSAutoRealm ar(cx, global2);
RootedScript script2(cx, JS::Compile(cx, options, emptySrcBuf));
RootedScript script2(cx, JS::CompileDontInflate(cx, options, emptySrcBuf));
CHECK(script2);
CHECK(JS::ubi::Node(script1).compartment() == global1->compartment());

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

@ -11,7 +11,7 @@
#include "builtin/String.h"
#include "js/BuildId.h" // JS::BuildIdCharVector, JS::SetProcessBuildIdOp
#include "js/CompilationAndEvaluation.h"
#include "js/CompilationAndEvaluation.h" // JS::CompileDontInflate
#include "js/SourceText.h" // JS::Source{Ownership,Text}
#include "js/Transcoding.h"
#include "jsapi-tests/tests.h"
@ -69,7 +69,7 @@ BEGIN_TEST(testXDR_bug506491) {
CHECK(srcBuf.init(cx, s, mozilla::ArrayLength(s) - 1,
JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
script = FreezeThaw(cx, script);
@ -98,7 +98,7 @@ BEGIN_TEST(testXDR_bug516827) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, "", 0, JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
script = FreezeThaw(cx, script);
@ -130,7 +130,7 @@ BEGIN_TEST(testXDR_source) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, *s, strlen(*s), JS::SourceOwnership::Borrowed));
JS::RootedScript script(cx, JS::Compile(cx, options, srcBuf));
JS::RootedScript script(cx, JS::CompileDontInflate(cx, options, srcBuf));
CHECK(script);
script = FreezeThaw(cx, script);
@ -158,7 +158,7 @@ BEGIN_TEST(testXDR_sourceMap) {
JS::SourceText<mozilla::Utf8Unit> srcBuf;
CHECK(srcBuf.init(cx, "", 0, JS::SourceOwnership::Borrowed));
script = JS::Compile(cx, options, srcBuf);
script = JS::CompileDontInflate(cx, options, srcBuf);
CHECK(script);
size_t len = strlen(*sm);