Closed
Bug 1734101
Opened 4 years ago
Closed 4 years ago
Encode/decode ScriptSource options
Categories
(Core :: JavaScript Engine, task, P1)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
95 Branch
| Tracking | Status | |
|---|---|---|
| firefox95 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
when decoding Stencil XDR, ScriptSource is initialized from ReadOnlyCompileOptions fields, but those information should be known from the original stencil used while encoding.
to introduce subset of CompileOptions in bug 1726498, we should remove the dependency to ReadOnlyCompileOptions there.
template <XDRMode mode>
/* static */
XDRResult ScriptSource::XDR(XDRState<mode>* xdr,
const ReadOnlyCompileOptions* maybeOptions,
RefPtr<ScriptSource>& source) {
JSContext* cx = xdr->cx();
if (mode == XDR_DECODE) {
...
if (!source->initFromOptions(cx, *maybeOptions)) {
return xdr->fail(JS::TranscodeResult::Throw);
}
bool ScriptSource::initFromOptions(JSContext* cx,
const ReadOnlyCompileOptions& options) {
MOZ_ASSERT(!filename_);
MOZ_ASSERT(!introducerFilename_);
mutedErrors_ = options.mutedErrors();
startLine_ = options.lineno;
introductionType_ = options.introductionType;
setIntroductionOffset(options.introductionOffset);
// The parameterListEnd_ is initialized later by setParameterListEnd, before
// we expose any scripts that use this ScriptSource to the debugger.
if (options.hasIntroductionInfo) {
MOZ_ASSERT(options.introductionType != nullptr);
const char* filename =
options.filename() ? options.filename() : "<unknown>";
UniqueChars formatted = FormatIntroducedFilename(
cx, filename, options.introductionLineno, options.introductionType);
if (!formatted) {
return false;
}
if (!setFilename(cx, std::move(formatted))) {
return false;
}
} else if (options.filename()) {
if (!setFilename(cx, options.filename())) {
return false;
}
}
if (options.introducerFilename()) {
if (!setIntroducerFilename(cx, options.introducerFilename())) {
return false;
}
}
return true;
}
Updated•4 years ago
|
Severity: -- → N/A
Priority: -- → P1
| Assignee | ||
Comment 1•4 years ago
|
||
due to ScriptSource.introductionType_ field's "statically allocated C string" requirement, we cannot encode/decode it.
JS::DecodeOptions needs the field.
other fields can be encoded/decoded.
| Assignee | ||
Comment 2•4 years ago
|
||
Depends on D128343
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/811bc98b7334
Encode/decode more ScriptSource fields. r=tcampbell
Comment 4•4 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
status-firefox95:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•