Commit 547568f7 authored by Toshihito Kikuchi's avatar Toshihito Kikuchi
Browse files

Bug 1711126 - The module index in the third-party modules ping may be -1. r=mhowell

This patch updates the regex pattern to match data where the module index of
a callstack is -1 or a non-negative integer.  -1 is legitimately set in
`CreateJSStackObject` when the frame address is not within any module in the
module list.

If the pattern did not match in debug build, calling `toBoolean()` hit the
assert because `matchResult` was not a boolean but null.  This patch fixes
that problem, too.

Differential Revision: https://phabricator.services.mozilla.com/D122020
parent 0a6caa93
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ class UntrustedModulesFixture : public TelemetryTestFixture {
    // On match, with aOnlyMatch = true, ExecuteRegExpNoStatics returns boolean
    // true.  If no match, ExecuteRegExpNoStatics returns Null.
    EXPECT_TRUE(matchResult.isBoolean() && matchResult.toBoolean());
    if (!matchResult.toBoolean()) {
    if (!matchResult.isBoolean() || !matchResult.toBoolean()) {
      // If match failed, print out the actual JSON kindly.
      wprintf(L"JSON: %s\n", json.get());
      wprintf(L"RE: %s\n", aPattern);
@@ -366,8 +366,8 @@ BOOL CALLBACK UntrustedModulesFixture::InitialModuleLoadOnce(PINIT_ONCE, void*,
    u"\"combinedStacks\":{" \
      u"\"memoryMap\":\\[\\[\"\\w+\\.\\w+\",\"[0-9A-Z]+\"\\]" \
        u"(,\\[\"\\w+\\.\\w+\",\"[0-9A-Z]+\\\"\\])*\\]," \
      u"\"stacks\":\\[\\[\\[\\d+,\\d+\\]" \
        u"(,\\[\\d+,\\d+\\])*\\]\\]}}"
      u"\"stacks\":\\[\\[\\[(-1|\\d+),\\d+\\]" \
        u"(,\\[(-1|\\d+),\\d+\\])*\\]\\]}}"

TEST_F(UntrustedModulesFixture, Serialize) {
  // clang-format off