Skip to content

Commit

Permalink
Fix build breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bhackett1024 committed Dec 3, 2021
1 parent 19b600e commit 5a094a9
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 72 deletions.
2 changes: 1 addition & 1 deletion gfx/layers/apz/src/APZCTreeManager.cpp
Expand Up @@ -1497,7 +1497,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// replaying. APZ does not work with the special layers constructed by
// the middleman processes being communicated with here.
if (dom::BrowserParent::AreRecordReplayTabsActive()) {
return result;
return state.Finish();
}

// Use a RAII class for updating the focus sequence number of this event
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BytecodeCompiler.cpp
Expand Up @@ -628,7 +628,7 @@ bool frontend::SourceAwareCompiler<Unit>::createSourceAndParser(JSContext* cx) {
// Note the contents of any compiled scripts when recording/replaying.
if (mozilla::recordreplay::IsRecordingOrReplaying()) {
mozilla::recordreplay::NoteContentParse(
this, stencil.input.options.filename(), "application/javascript",
this, options.filename(), "application/javascript",
sourceBuffer_.units(), sourceBuffer_.length());
}

Expand Down
16 changes: 4 additions & 12 deletions js/src/frontend/BytecodeEmitter.cpp
Expand Up @@ -491,7 +491,7 @@ bool BytecodeEmitter::emitCall(JSOp op, uint16_t argc,
return false;
}
if (allowRecordReplayAssert &&
!maybeEmitRecordReplayAssert(cx->parserNames().callFunction)) {
!maybeEmitRecordReplayAssert("callFunction")) {
return false;
}
return true;
Expand Down Expand Up @@ -972,11 +972,6 @@ bool BytecodeEmitter::emitAtomOp(JSOp op, TaggedParserAtomIndex atom) {
bool BytecodeEmitter::emitAtomOp(JSOp op, GCThingIndex atomIndex) {
MOZ_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);

if (shouldInstrument != ShouldInstrument::No &&
!emitInstrumentationForOpcode(op, atomIndex)) {
return false;
}

if (!emitGCIndexOp(op, atomIndex)) {
return false;
}
Expand Down Expand Up @@ -11085,13 +11080,10 @@ MOZ_NEVER_INLINE bool BytecodeEmitter::emitInstrumentationSlow(
}
// [stack] CALLBACK UNDEFINED

const ParserAtom* atom = RealmInstrumentation::getInstrumentationKindName(
cx, compilationState.parserAtoms, kind);
if (!atom) {
return false;
}
const char* kindName = RealmInstrumentation::getInstrumentationKindName(kind);
TaggedParserAtomIndex kindIndex = parserAtoms().internAscii(cx, kindName, strlen(kindName));

if (!emitAtomOp(JSOp::String, atom)) {
if (!emitAtomOp(JSOp::String, kindIndex)) {
return false;
}
// [stack] CALLBACK UNDEFINED KIND
Expand Down
23 changes: 13 additions & 10 deletions js/src/frontend/BytecodeEmitter.h
Expand Up @@ -1043,44 +1043,47 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
return false;
}

MOZ_MUST_USE bool emitExecutionProgress() {
[[nodiscard]] bool emitExecutionProgress() {
if (shouldEmitInstrumentation()) {
return emit1(JSOp::ExecutionProgress);
}
return true;
}

MOZ_MUST_USE bool emitInstrumentation(InstrumentationKind kind) {
[[nodiscard]] bool emitInstrumentation(InstrumentationKind kind) {
if (shouldEmitInstrumentation()) {
return emitInstrumentationSlow(kind, std::function<bool(uint32_t)>());
}
return true;
}

MOZ_MUST_USE bool emitInstrumentationForOpcode(JSOp op,
GCThingIndex atomIndex) {
if (shouldEmitInstrumentation()) {
return emitInstrumentationForOpcodeSlow(op, atomIndex);
[[nodiscard]] bool maybeEmitRecordReplayAssert(GCThingIndex atomIndex) {
if (shouldEmitInstrumentation() &&
ShouldEmitRecordReplayAssert(parser->options().filename(),
bytecodeSection().currentLine(),
bytecodeSection().lastColumn())) {
return emitDupAt(0) && emitAtomOp(JSOp::RecordReplayAssert, atomIndex);
}
return true;
}

MOZ_MUST_USE bool maybeEmitRecordReplayAssert(GCThingIndex atomIndex) {
[[nodiscard]] bool maybeEmitRecordReplayAssert(TaggedParserAtomIndex atom) {
if (shouldEmitInstrumentation() &&
ShouldEmitRecordReplayAssert(parser->options().filename(),
bytecodeSection().currentLine(),
bytecodeSection().lastColumn())) {
return emitDupAt(0) && emitAtomOp(JSOp::RecordReplayAssert, atomIndex);
return emitDupAt(0) && emitAtomOp(JSOp::RecordReplayAssert, atom);
}
return true;
}

MOZ_MUST_USE bool maybeEmitRecordReplayAssert(const ParserAtom* atom) {
[[nodiscard]] bool maybeEmitRecordReplayAssert(const char* atom) {
if (shouldEmitInstrumentation() &&
ShouldEmitRecordReplayAssert(parser->options().filename(),
bytecodeSection().currentLine(),
bytecodeSection().lastColumn())) {
return emitDupAt(0) && emitAtomOp(JSOp::RecordReplayAssert, atom);
TaggedParserAtomIndex index = parserAtoms().internAscii(cx, atom, strlen(atom));
return emitDupAt(0) && emitAtomOp(JSOp::RecordReplayAssert, index);
}
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions js/src/frontend/ElemOpEmitter.cpp
Expand Up @@ -55,7 +55,7 @@ bool ElemOpEmitter::emitGet() {
MOZ_ASSERT(state_ == State::Key);

// Assert the key in the get.
if (!bce_->maybeEmitRecordReplayAssert(bce_->cx->parserNames().element)) {
if (!bce_->maybeEmitRecordReplayAssert("element")) {
return false;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ bool ElemOpEmitter::emitGet() {
}

// Assert the value read by the get.
if (!bce_->maybeEmitRecordReplayAssert(bce_->cx->parserNames().element)) {
if (!bce_->maybeEmitRecordReplayAssert("element")) {
return false;
}

Expand All @@ -132,7 +132,7 @@ bool ElemOpEmitter::prepareForRhs() {
MOZ_ASSERT_IF(isCompoundAssignment(), state_ == State::Get);

// Assert the element written by the set.
if (!bce_->maybeEmitRecordReplayAssert(bce_->cx->parserNames().element)) {
if (!bce_->maybeEmitRecordReplayAssert("element")) {
return false;
}

Expand Down Expand Up @@ -209,7 +209,7 @@ bool ElemOpEmitter::emitAssignment() {
MOZ_ASSERT_IF(isPropInit(), !isSuper());

// Assert the value written by the set.
if (!bce_->maybeEmitRecordReplayAssert(bce_->cx->parserNames().element)) {
if (!bce_->maybeEmitRecordReplayAssert("element")) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/ObjectEmitter.cpp
Expand Up @@ -360,7 +360,7 @@ bool PropertyEmitter::emitInitIndexOrComputed(JSOp op) {
// [stack] CTOR? OBJ CTOR? KEY VAL

// Assert the value being written to the object.
if (!bce_->maybeEmitRecordReplayAssert(bce_->cx->parserNames().element)) {
if (!bce_->maybeEmitRecordReplayAssert("element")) {
return false;
}

Expand Down
6 changes: 6 additions & 0 deletions js/src/jit/MIROps.yaml
Expand Up @@ -2231,6 +2231,12 @@
can_recover: true
clone: true

- name: ExecutionProgress
gen_boilerplate: false

- name: RecordReplayAssertValue
gen_boilerplate: false

- name: WasmNeg
gen_boilerplate: false

Expand Down
2 changes: 1 addition & 1 deletion js/src/jsfriendapi.h
Expand Up @@ -736,7 +736,7 @@ extern JS_PUBLIC_API uint64_t GetGCHeapUsageForObjectZone(JSObject* obj);
* Return whether a global object's realm has had instrumentation enabled by a
* Debugger.
*/
extern JS_FRIEND_API bool GlobalHasInstrumentation(JSObject* global);
extern JS_PUBLIC_API bool GlobalHasInstrumentation(JSObject* global);

class JS_PUBLIC_API CompartmentTransplantCallback {
public:
Expand Down
1 change: 1 addition & 0 deletions js/src/vm/DateTime.cpp
Expand Up @@ -6,6 +6,7 @@

#include "vm/DateTime.h"

#include "mozilla/RecordReplay.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/TextUtils.h"

Expand Down
13 changes: 6 additions & 7 deletions js/src/vm/Instrumentation.cpp
Expand Up @@ -96,13 +96,10 @@ static bool StringToInstrumentationKind(JSContext* cx, HandleString str,
}

/* static */
const frontend::ParserAtom* RealmInstrumentation::getInstrumentationKindName(
JSContext* cx, frontend::ParserAtomsTable& parserAtoms,
InstrumentationKind kind) {
const char* RealmInstrumentation::getInstrumentationKindName(InstrumentationKind kind) {
for (size_t i = 0; i < std::size(instrumentationNames); i++) {
if (kind == (InstrumentationKind)(1 << i)) {
return parserAtoms.internAscii(cx, instrumentationNames[i],
strlen(instrumentationNames[i]));
return instrumentationNames[i];
}
}
MOZ_CRASH("Unexpected instrumentation kind");
Expand Down Expand Up @@ -180,8 +177,10 @@ bool RealmInstrumentation::setActive(JSContext* cx,
// instrumentation activity changes.
js::CancelOffThreadIonCompile(cx->runtime());
cx->zone()->setPreservingCode(false);
cx->zone()->discardJitCode(cx->runtime()->defaultFreeOp(),
Zone::KeepBaselineCode);

Zone::DiscardOptions options;
options.discardBaselineCode = false;
cx->zone()->discardJitCode(cx->runtime()->defaultFreeOp(), options);
}

return true;
Expand Down
4 changes: 1 addition & 3 deletions js/src/vm/Instrumentation.h
Expand Up @@ -71,9 +71,7 @@ class RealmInstrumentation {
static uint32_t getInstrumentationKinds(GlobalObject* global);

// Get the string name of an instrumentation kind.
static const frontend::ParserAtom* getInstrumentationKindName(
JSContext* cx, frontend::ParserAtomsTable& parserAtoms,
InstrumentationKind kind);
static const char* getInstrumentationKindName(InstrumentationKind kind);

static bool getScriptId(JSContext* cx, Handle<GlobalObject*> global,
HandleScript script, int32_t* id);
Expand Down
8 changes: 4 additions & 4 deletions js/src/vm/JSScript.cpp
Expand Up @@ -1102,13 +1102,13 @@ XDRResult js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
// instructions.
if (xdr->hasOptions() ? !!xdr->options().instrumentationKinds
: !!cx->global()->getInstrumentationHolder()) {
return xdr->fail(JS::TranscodeResult_Failure);
return xdr->fail(JS::TranscodeResult::Failure);
}

// When recording/replaying, whether globals are instrumented can vary between
// recording and replaying.
if (mozilla::recordreplay::IsRecordingOrReplaying()) {
return xdr->fail(JS::TranscodeResult_Failure);
return xdr->fail(JS::TranscodeResult::Failure);
}

if (mode == XDR_ENCODE) {
Expand Down Expand Up @@ -3197,8 +3197,8 @@ XDRResult ScriptSource::XDR(XDRState<mode>* xdr,
MOZ_ASSERT(source->filename());

// Note the content of sources decoded when recording or replaying.
if (!MaybeNoteContentParse(xdr->cx(), ss)) {
return xdr->fail(JS::TranscodeResult_Throw);
if (!MaybeNoteContentParse(xdr->cx(), source)) {
return xdr->fail(JS::TranscodeResult::Throw);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/Xdr.cpp
Expand Up @@ -290,7 +290,7 @@ XDRResult XDRState<mode>::codeScript(MutableHandleScript scriptp) {
// when recording/replaying due to execution progress and instrumentation
// opcodes.
if (mozilla::recordreplay::IsRecordingOrReplaying()) {
return fail(JS::TranscodeResult_Failure);
return fail(JS::TranscodeResult::Failure);
}

TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx());
Expand Down
26 changes: 5 additions & 21 deletions toolkit/components/resistfingerprinting/nsRFPService.cpp
Expand Up @@ -608,19 +608,6 @@ void nsRFPService::GetSpoofedUserAgent(nsACString& userAgent,
// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/userAgent
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

<<<<<<< HEAD
const char* spoofedVersion = recordreplay::CurrentFirefoxVersion();
const char* spoofedOS = isForHTTPHeader ? SPOOFED_HTTP_UA_OS : SPOOFED_UA_OS;
userAgent.Assign(nsPrintfCString(
"Mozilla/5.0 (%s; rv:%s) Gecko/%s Firefox/%s", spoofedOS,
spoofedVersion, LEGACY_UA_GECKO_TRAIL, spoofedVersion));
||||||| b7c85e09aa5a
uint32_t spoofedVersion = GetSpoofedVersion();
const char* spoofedOS = isForHTTPHeader ? SPOOFED_HTTP_UA_OS : SPOOFED_UA_OS;
userAgent.Assign(nsPrintfCString(
"Mozilla/5.0 (%s; rv:%d.0) Gecko/%s Firefox/%d.0", spoofedOS,
spoofedVersion, LEGACY_UA_GECKO_TRAIL, spoofedVersion));
=======
// These magic numbers are the lengths of the UA string literals below.
// Assume three-digit Firefox version numbers so we have room to grow.
size_t preallocatedLength =
Expand All @@ -631,7 +618,7 @@ void nsRFPService::GetSpoofedUserAgent(nsACString& userAgent,
2;
userAgent.SetCapacity(preallocatedLength);

uint32_t spoofedVersion = GetSpoofedVersion();
const char* spoofedVersion = recordreplay::CurrentFirefoxVersion();

// "Mozilla/5.0 (%s; rv:%d.0) Gecko/%d Firefox/%d.0"
userAgent.AssignLiteral("Mozilla/5.0 (");
Expand All @@ -643,22 +630,19 @@ void nsRFPService::GetSpoofedUserAgent(nsACString& userAgent,
}

userAgent.AppendLiteral("; rv:");
userAgent.AppendInt(spoofedVersion);
userAgent.AppendLiteral(".0) Gecko/");
userAgent.Append(spoofedVersion);
userAgent.AppendLiteral(") Gecko/");

#if defined(ANDROID)
userAgent.AppendInt(spoofedVersion);
userAgent.AppendLiteral(".0");
userAgent.Append(spoofedVersion);
#else
userAgent.AppendLiteral(LEGACY_UA_GECKO_TRAIL);
#endif

userAgent.AppendLiteral(" Firefox/");
userAgent.AppendInt(spoofedVersion);
userAgent.AppendLiteral(".0");
userAgent.Append(spoofedVersion);

MOZ_ASSERT(userAgent.Length() <= preallocatedLength);
>>>>>>> esr91
}

static const char* gCallbackPrefs[] = {
Expand Down
5 changes: 0 additions & 5 deletions toolkit/recordreplay/JSControl.cpp
Expand Up @@ -19,7 +19,6 @@
#include "rrIConnection.h"
#include "rrIModule.h"
#include "xpcprivate.h"
#include "nsMediaFeatures.h"

#include <fcntl.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -140,10 +139,6 @@ void EnsureModuleInitialized() {
return;
}

// Initialization so we can repaint at the first checkpoint without having
// an unhandled recording divergence.
nsMediaFeatures::InitSystemMetrics();

AutoSafeJSContext cx;
JSAutoRealm ar(cx, xpc::PrivilegedJunkScope());

Expand Down
2 changes: 1 addition & 1 deletion xpcom/threads/nsTimerImpl.cpp
Expand Up @@ -381,7 +381,7 @@ nsresult nsTimerImpl::InitCommon(const TimeDuration& aDelay, uint32_t aType,
++mGeneration;

// Diagnostic for https://github.com/RecordReplay/backend/issues/3787
recordreplay::RecordReplayAssert("nsTimerImpl::InitCommon #1");
mozilla::recordreplay::RecordReplayAssert("nsTimerImpl::InitCommon #1");

mType = (uint8_t)aType;
mDelay = aDelay;
Expand Down

0 comments on commit 5a094a9

Please sign in to comment.