mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-18 06:19:47 +00:00
1672300c41
- Bug 1204027 - Rejigger export-parsing code to make a subsequent change simpler. r=arai (af4ec6b65e)
- Bug 1204027 - Forbid escapes within keywords when parsing/tokenizing. r=arai (200badac56)
- Bug 1204027 - Followup to fix a hazard, and (conveniently enough) to also make a minor cleanup enabled by the fix. r=bustage (9fb514a7a2)
- Bug 1204857 - Report an error if there's trailing garbage after parsing a module r=efaust (515f5e315e)
- Bug 1168091 - Initialize startLine and startColumn members in FunctionBox constructor, r=jorendorff. (61e1c71710)
- Bug 1206750 - Don't assert when |export ... from 'str'| is followed by a regular expression literal on a new line, with no intervening semicolon. r=arai (2d1eb977f7)
- Bug 1206980 - Separate MatchOrInsertSemicolon into 2 functions for after expression and non-expression. r=Waldo (086dce51eb)
- Bug 1022369 - Correctly execute |Function("var x\n/regex/g")| without throwing a SyntaxError. r=Waldo (7cdd72425f)
- Micro-fix to the parser for a linking issue that *seemingly* should affect everyone, yet hasn't produced any complaints I'm aware of yet. No bug, r=me for a trivial refactoring that evades the problem (3f4380fbfe)
- bit of Bug 1167029 - Remove support for let blocks - matches TFF (24599beb85)
- Bug 1187062 - Part 1: Add the JS::ubi::StackFrame interface; r=sfink (2f9107cdce)
- Bug 1187062 - Part 2: Implement a concrete JS::ubi::StackFrame class backed by js::SavedFrame; r=sfink (68a4a5f232)
- Bug 1187062 - Part 3: Add jsapi-tests for JS::ubi::StackFrame; r=sfink (9439163007)
- Bug 1194424 - Part 1: Serialize JS::ubi::StackFrame allocation stacks into core dumps; r=sfink (51d59a2770)
- Bug 1194424 - Part 2: Deserialize JS::ubi::StackFrame allocation stacks from core dumps; r=sfink (b65d1490aa)
- Bug 1194426 - Add sourceLength and functionDisplayNameLength to JS::ubi::StackFrame. r=sfink (52d7aeb35d)
- Bug 1194424 - Part 3: Implement a concrete JS::ubi::StackFrame specialization backed by a frame deserialized from a core dump; r=sfink (1a7854a393)
- Bug 1194424 - Part 5: gtest for DeserializedStackFrame ubi::StackFrames; r=sfink (2fb1d5b9e2)
- Bug 1203297 - Fix even more unified bustage; r=efaust (ce837cd0fe)
- Bug 1155923 - Add Deprecated attribute to interfaces, r=peterv (a05d3a97c1)
- Bug 1209325: Move implementation of JS WeakMap type into its own file. r=terrence. (a992e4670e)
- Bug 1175394 part 2 - Rename normal/strict arguments to mapped/unmapped arguments. r=jorendorff (ee2fae5832)
- Bug 1054756, part 5 - Remove Class::convert. (3b27b97e69)
- js/irregexp: HACK: undefining `min` and `max` when building with MSVC, fix build (5c249ce4)
- js: more exporting for fixing shared mozjs build (43705277)
92 lines
3.1 KiB
C++
92 lines
3.1 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// Test that the `JS::ubi::StackFrame`s we create from
|
|
// `mozilla::devtools::DeserializedStackFrame` instances look and behave as we would
|
|
// like.
|
|
|
|
#include "DevTools.h"
|
|
#include "js/TypeDecls.h"
|
|
#include "mozilla/devtools/DeserializedNode.h"
|
|
|
|
using testing::Field;
|
|
using testing::ReturnRef;
|
|
|
|
// A mock DeserializedStackFrame for testing.
|
|
struct MockDeserializedStackFrame : public DeserializedStackFrame
|
|
{
|
|
MockDeserializedStackFrame() : DeserializedStackFrame() { }
|
|
};
|
|
|
|
DEF_TEST(DeserializedStackFrameUbiStackFrames, {
|
|
StackFrameId id = 1L << 42;
|
|
uint32_t line = 1337;
|
|
uint32_t column = 9; // 3 space tabs!?
|
|
const char16_t* source = MOZ_UTF16("my-javascript-file.js");
|
|
const char16_t* functionDisplayName = MOZ_UTF16("myFunctionName");
|
|
|
|
MockDeserializedStackFrame mocked;
|
|
mocked.id = id;
|
|
mocked.line = line;
|
|
mocked.column = column;
|
|
mocked.source = source;
|
|
mocked.functionDisplayName = functionDisplayName;
|
|
|
|
DeserializedStackFrame& deserialized = mocked;
|
|
JS::ubi::StackFrame ubiFrame(&deserialized);
|
|
|
|
// Test the JS::ubi::StackFrame accessors.
|
|
|
|
EXPECT_EQ(id, ubiFrame.identifier());
|
|
EXPECT_EQ(JS::ubi::StackFrame(), ubiFrame.parent());
|
|
EXPECT_EQ(line, ubiFrame.line());
|
|
EXPECT_EQ(column, ubiFrame.column());
|
|
EXPECT_EQ(JS::ubi::AtomOrTwoByteChars(source), ubiFrame.source());
|
|
EXPECT_EQ(JS::ubi::AtomOrTwoByteChars(functionDisplayName),
|
|
ubiFrame.functionDisplayName());
|
|
EXPECT_FALSE(ubiFrame.isSelfHosted());
|
|
EXPECT_FALSE(ubiFrame.isSystem());
|
|
|
|
JS::RootedObject savedFrame(cx);
|
|
EXPECT_TRUE(ubiFrame.constructSavedFrameStack(cx, &savedFrame));
|
|
|
|
uint32_t frameLine;
|
|
ASSERT_EQ(JS::SavedFrameResult::Ok, JS::GetSavedFrameLine(cx, savedFrame, &frameLine));
|
|
EXPECT_EQ(line, frameLine);
|
|
|
|
uint32_t frameColumn;
|
|
ASSERT_EQ(JS::SavedFrameResult::Ok, JS::GetSavedFrameColumn(cx, savedFrame, &frameColumn));
|
|
EXPECT_EQ(column, frameColumn);
|
|
|
|
JS::RootedObject parent(cx);
|
|
ASSERT_EQ(JS::SavedFrameResult::Ok, JS::GetSavedFrameParent(cx, savedFrame, &parent));
|
|
EXPECT_EQ(nullptr, parent);
|
|
|
|
ASSERT_EQ(NS_strlen(source), 21U);
|
|
char16_t sourceBuf[21] = {};
|
|
|
|
// Test when the length is shorter than the string length.
|
|
auto written = ubiFrame.source(RangedPtr<char16_t>(sourceBuf), 3);
|
|
EXPECT_EQ(written, 3U);
|
|
for (size_t i = 0; i < 3; i++) {
|
|
EXPECT_EQ(sourceBuf[i], source[i]);
|
|
}
|
|
|
|
written = ubiFrame.source(RangedPtr<char16_t>(sourceBuf), 21);
|
|
EXPECT_EQ(written, 21U);
|
|
for (size_t i = 0; i < 21; i++) {
|
|
EXPECT_EQ(sourceBuf[i], source[i]);
|
|
}
|
|
|
|
ASSERT_EQ(NS_strlen(functionDisplayName), 14U);
|
|
char16_t nameBuf[14] = {};
|
|
|
|
written = ubiFrame.functionDisplayName(RangedPtr<char16_t>(nameBuf), 14);
|
|
EXPECT_EQ(written, 14U);
|
|
for (size_t i = 0; i < 14; i++) {
|
|
EXPECT_EQ(nameBuf[i], functionDisplayName[i]);
|
|
}
|
|
});
|