This commit is contained in:
Phil Ringnalda 2016-11-25 21:26:21 -08:00
Родитель 53c5c8448e 38790079e4
Коммит dc33a3b7dc
194 изменённых файлов: 1284 добавлений и 1071 удалений

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

@ -37,8 +37,8 @@ function promiseNewChannelResponse(uri) {
add_task(function*() {
// We haven't set a permission yet - so even the "good" URI should fail.
let got = yield promiseNewChannelResponse(TEST_URI_GOOD);
// Should have no data.
Assert.ok(got.message === undefined, "should have failed to get any data");
// Should return an error.
Assert.ok(got.message.errno === 2, "should have failed with errno 2, no such channel");
// Add a permission manager entry for our URI.
Services.perms.add(TEST_URI_GOOD,
@ -76,9 +76,9 @@ add_task(function*() {
Assert.ok(!got.message.modifiedPreferences, "should not have a modifiedPreferences key");
Assert.ok(!got.message.crashes, "should not have crash info");
// Now a http:// URI - should get nothing even with the permission setup.
// Now a http:// URI - should receive an error
got = yield promiseNewChannelResponse(TEST_URI_BAD);
Assert.ok(got.message === undefined, "should have failed to get any data");
Assert.ok(got.message.errno === 2, "should have failed with errno 2, no such channel");
// Check that the page can send an object as well if it's in the whitelist
let webchannelWhitelistPref = "webchannel.allowObject.urlWhitelist";

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

@ -36,6 +36,12 @@
case "object":
test_object();
break;
case "error_thrown":
test_error_thrown();
break;
case "error_invalid_channel":
test_error_invalid_channel();
break;
default:
throw new Error(`INVALID TEST NAME ${testName}`);
}
@ -172,6 +178,44 @@
window.dispatchEvent(stringMessage);
}
function test_error_thrown() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "error",
message: {
command: "oops"
}
})
});
// echo the response back to chrome - chrome will check it is the
// expected error.
window.addEventListener("WebChannelMessageToContent", function(e) {
echoEventToChannel(e, "echo");
}, true);
window.dispatchEvent(event);
}
function test_error_invalid_channel() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "invalid-channel",
message: {
command: "oops"
}
})
});
// echo the response back to chrome - chrome will check it is the
// expected error.
window.addEventListener("WebChannelMessageToContent", function(e) {
echoEventToChannel(e, "echo");
}, true);
window.dispatchEvent(event);
}
function echoEventToChannel(e, channelId) {
var echoedEvent = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({

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

@ -396,7 +396,68 @@ var gTests = [
channel.stopListening();
});
}
}
},
{
desc: "WebChannel errors handling the message are delivered back to content",
run: function* () {
const ERRNO_UNKNOWN_ERROR = 999; // WebChannel.jsm doesn't export this.
// The channel where we purposely fail responding to a command.
let channel = new WebChannel("error", Services.io.newURI(HTTP_PATH, null, null));
// The channel where we see the response when the content sees the error
let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH, null, null));
let testDonePromise = new Promise((resolve, reject) => {
// listen for the confirmation that content saw the error.
echoChannel.listen((id, message, sender) => {
is(id, "echo");
is(message.error, "oh no");
is(message.errno, ERRNO_UNKNOWN_ERROR);
resolve();
});
// listen for a message telling us to simulate an error.
channel.listen((id, message, sender) => {
is(id, "error");
is(message.command, "oops");
throw new Error("oh no");
});
});
yield BrowserTestUtils.withNewTab({
gBrowser,
url: HTTP_PATH + HTTP_ENDPOINT + "?error_thrown"
}, function* () {
yield testDonePromise;
channel.stopListening();
echoChannel.stopListening();
});
}
},
{
desc: "WebChannel errors due to an invalid channel are delivered back to content",
run: function* () {
const ERRNO_NO_SUCH_CHANNEL = 2; // WebChannel.jsm doesn't export this.
// The channel where we see the response when the content sees the error
let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH, null, null));
let testDonePromise = new Promise((resolve, reject) => {
// listen for the confirmation that content saw the error.
echoChannel.listen((id, message, sender) => {
is(id, "echo");
is(message.error, "No Such Channel");
is(message.errno, ERRNO_NO_SUCH_CHANNEL);
resolve();
});
});
yield BrowserTestUtils.withNewTab({
gBrowser,
url: HTTP_PATH + HTTP_ENDPOINT + "?error_invalid_channel"
}, function* () {
yield testDonePromise;
echoChannel.stopListening();
});
}
},
]; // gTests
function test() {

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

@ -110,10 +110,6 @@ span#hostname {
#automaticallyReportInFuture {
cursor: pointer;
display: inline-block;
padding-inline-start: 2.3em;
text-indent: -2.3em;
line-height: 16px
}
#errorCode:not([href]) {

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

@ -96,7 +96,6 @@
-moz-appearance: none;
padding: 2px !important;
border-radius: 50%;
color: graytext;
}
.downloadButton > .button-box > .button-icon {
@ -120,10 +119,6 @@
background-color: -moz-fieldtext;
}
@itemFocused@ > .downloadButtonArea > .downloadButton > .button-box {
color: inherit;
}
@itemFocused@ > .downloadButtonArea > .downloadButton:hover > .button-box {
background-color: HighlightText;
color: Highlight;

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

@ -260,7 +260,7 @@ richlistitem[type="download"] > .downloadMainArea {
border: none;
background: transparent;
padding: 8px;
color: graytext;
color: inherit;
}
.downloadButton > .button-box > .button-icon {
@ -307,10 +307,6 @@ richlistitem[type="download"] > .downloadMainArea {
color: white;
}
@item@[verdict="Malware"]:hover > .downloadButtonArea > .downloadButton {
color: inherit;
}
/*** Button icons ***/
.downloadIconCancel > .button-box > .button-icon {

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

@ -6,6 +6,8 @@
// Test outerHTML edition via the markup-view
requestLongerTimeout(2);
loadHelperScript("helper_outerhtml_test_runner.js");
const TEST_DATA = [{

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

@ -70,6 +70,9 @@ pref("devtools.fontinspector.enabled", true);
// Enable the Layout View
pref("devtools.layoutview.enabled", false);
// Grid highlighter preferences
pref("devtools.gridinspector.showInfiniteLines", false);
// By how many times eyedropper will magnify pixels
pref("devtools.eyedropper.zoom", 6);

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

@ -314,7 +314,8 @@ function copyPermanentKey(outer, inner) {
// what SessionStore uses to identify each browser.
let outerMM = outer[FRAME_LOADER].messageManager;
let onHistoryEntry = message => {
let history = message.data.data.history;
let data = message.data.data;
let history = data.history || data.historychange;
if (!history || !history.entries) {
// Wait for a message that contains history data
return;

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

@ -1736,18 +1736,6 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
}
// It would be cleanest to mark nodes as dirty when (a) they're created and
// (b) they're unbound from a tree. However, we can't easily do (a) right now,
// because IsStyledByServo() is not always easy to check at node creation time,
// and the bits have different meaning in the non-IsStyledByServo case.
//
// So for now, we just mark nodes as dirty when they're inserted into a
// document or shadow tree.
if (IsStyledByServo() && IsInComposedDoc()) {
MOZ_ASSERT(!HasServoData());
SetIsDirtyForServo();
}
// XXXbz script execution during binding can trigger some of these
// postcondition asserts.... But we do want that, since things will
// generally be quite broken when that happens.
@ -3922,3 +3910,12 @@ Element::UpdateIntersectionObservation(DOMIntersectionObserver* aObserver, int32
}
return false;
}
void
Element::ClearServoData() {
#ifdef MOZ_STYLO
Servo_Element_ClearData(this);
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}

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

@ -16,6 +16,7 @@
#include "mozilla/dom/FragmentOrElement.h" // for base class
#include "nsChangeHint.h" // for enum
#include "mozilla/EventStates.h" // for member
#include "mozilla/ServoTypes.h"
#include "mozilla/dom/DirectionalityUtils.h"
#include "nsIDOMElement.h"
#include "nsILinkHandler.h"
@ -164,6 +165,14 @@ public:
"Bad NodeType in aNodeInfo");
SetIsElement();
}
~Element()
{
#ifdef MOZ_STYLO
NS_ASSERTION(!HasServoData(), "expected ServoData to be cleared earlier");
#endif
}
#endif // MOZILLA_INTERNAL_API
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID)
@ -391,6 +400,40 @@ public:
Directionality GetComputedDirectionality() const;
inline Element* GetFlattenedTreeParentElement() const;
bool HasDirtyDescendantsForServo() const
{
MOZ_ASSERT(IsStyledByServo());
return HasFlag(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void SetHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
SetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void UnsetHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
UnsetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
inline void NoteDirtyDescendantsForServo();
#ifdef DEBUG
inline bool DirtyDescendantsBitIsPropagatedForServo();
#endif
bool HasServoData() {
#ifdef MOZ_STYLO
return !!mServoData.Get();
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}
void ClearServoData();
protected:
/**
* Method to get the _intrinsic_ content state of this element. This is the
@ -1391,6 +1434,10 @@ private:
// Data members
EventStates mState;
#ifdef MOZ_STYLO
// Per-node data managed by Servo.
mozilla::ServoCell<ServoNodeData*> mServoData;
#endif
};
class RemoveFromBindingManagerRunnable : public mozilla::Runnable
@ -1488,7 +1535,7 @@ inline const mozilla::dom::Element* nsINode::AsElement() const
inline void nsINode::UnsetRestyleFlagsIfGecko()
{
if (IsElement() && !IsStyledByServo()) {
if (IsElement() && !AsElement()->IsStyledByServo()) {
UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
}
}

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

@ -8,6 +8,7 @@
#define mozilla_dom_ElementInlines_h
#include "mozilla/dom/Element.h"
#include "nsIContentInlines.h"
#include "nsIDocument.h"
namespace mozilla {
@ -25,6 +26,46 @@ Element::UnregisterActivityObserver()
OwnerDoc()->UnregisterActivityObserver(this);
}
inline Element*
Element::GetFlattenedTreeParentElement() const
{
nsINode* parentNode = GetFlattenedTreeParentNode();
if MOZ_LIKELY(parentNode && parentNode->IsElement()) {
return parentNode->AsElement();
}
return nullptr;
}
inline void
Element::NoteDirtyDescendantsForServo()
{
Element* curr = this;
while (curr && !curr->HasDirtyDescendantsForServo()) {
curr->SetHasDirtyDescendantsForServo();
curr = curr->GetFlattenedTreeParentElement();
}
MOZ_ASSERT(DirtyDescendantsBitIsPropagatedForServo());
}
#ifdef DEBUG
inline bool
Element::DirtyDescendantsBitIsPropagatedForServo()
{
Element* curr = this;
while (curr) {
if (!curr->HasDirtyDescendantsForServo()) {
return false;
}
nsINode* parentNode = curr->GetParentNode();
curr = curr->GetFlattenedTreeParentElement();
MOZ_ASSERT_IF(!curr, parentNode == OwnerDoc());
}
return true;
}
#endif
} // namespace dom
} // namespace mozilla

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

@ -2344,51 +2344,3 @@ FragmentOrElement::SetIsElementInStyleScopeFlagOnShadowTree(bool aInStyleScope)
shadowRoot = shadowRoot->GetOlderShadowRoot();
}
}
#ifdef DEBUG
static void
AssertDirtyDescendantsBitPropagated(nsINode* aNode)
{
MOZ_ASSERT(aNode->HasDirtyDescendantsForServo());
nsINode* parent = aNode->GetFlattenedTreeParentNode();
if (!parent->IsContent()) {
MOZ_ASSERT(parent == aNode->OwnerDoc());
MOZ_ASSERT(parent->HasDirtyDescendantsForServo());
} else {
AssertDirtyDescendantsBitPropagated(parent);
}
}
#else
static void AssertDirtyDescendantsBitPropagated(nsINode* aNode) {}
#endif
void
nsIContent::MarkAncestorsAsHavingDirtyDescendantsForServo()
{
MOZ_ASSERT(IsInComposedDoc());
// Get the parent in the flattened tree.
nsINode* parent = GetFlattenedTreeParentNode();
// Loop until we hit a base case.
while (true) {
// Base case: the document.
if (!parent->IsContent()) {
MOZ_ASSERT(parent == OwnerDoc());
parent->SetHasDirtyDescendantsForServo();
return;
}
// Base case: the parent is already marked, and therefore
// so are all its ancestors.
if (parent->HasDirtyDescendantsForServo()) {
AssertDirtyDescendantsBitPropagated(parent);
return;
}
// Mark the parent and iterate.
parent->SetHasDirtyDescendantsForServo();
parent = parent->GetFlattenedTreeParentNode();
}
}

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

@ -552,18 +552,6 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
UpdateEditableState(false);
// It would be cleanest to mark nodes as dirty when (a) they're created and
// (b) they're unbound from a tree. However, we can't easily do (a) right now,
// because IsStyledByServo() is not always easy to check at node creation time,
// and the bits have different meaning in the non-IsStyledByServo case.
//
// So for now, we just mark nodes as dirty when they're inserted into a
// document or shadow tree.
if (IsStyledByServo() && IsInComposedDoc()) {
MOZ_ASSERT(!HasServoData());
SetIsDirtyForServo();
}
NS_POSTCONDITION(aDocument == GetUncomposedDoc(), "Bound to wrong document");
NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
NS_POSTCONDITION(aBindingParent == GetBindingParent(),
@ -595,16 +583,6 @@ nsGenericDOMDataNode::UnbindFromTree(bool aDeep, bool aNullParent)
}
ClearInDocument();
// Computed styled data isn't useful for detached nodes, and we'll need to
// recomputed it anyway if we ever insert the nodes back into a document.
if (IsStyledByServo()) {
ClearServoData();
} else {
#ifdef MOZ_STYLO
MOZ_ASSERT(!HasServoData());
#endif
}
if (aNullParent || !mParent->IsInShadowTree()) {
UnsetFlags(NODE_IS_IN_SHADOW_TREE);

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

@ -938,14 +938,6 @@ public:
*/
mozilla::dom::Element* GetEditingHost();
/**
* Set NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO all the way up the flattened
* parent chain to the document. If an ancestor is found with the bit already
* set, this method asserts that all of its ancestors also have the bit set.
*/
void MarkAncestorsAsHavingDirtyDescendantsForServo();
/**
* Determining language. Look at the nearest ancestor element that has a lang
* attribute in the XML namespace or is an HTML/SVG element and has a lang in

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

@ -152,10 +152,6 @@ nsINode::~nsINode()
{
MOZ_ASSERT(!HasSlots(), "nsNodeUtils::LastRelease was not called?");
MOZ_ASSERT(mSubtreeRoot == this, "Didn't restore state properly?");
#ifdef MOZ_STYLO
NS_ASSERTION(!HasServoData(), "expected ServoNodeData to be cleared earlier");
ClearServoData();
#endif
}
void*
@ -1400,15 +1396,6 @@ nsINode::UnoptimizableCCNode() const
AsElement()->IsInNamespace(kNameSpaceID_XBL));
}
void
nsINode::ClearServoData() {
#ifdef MOZ_STYLO
Servo_Node_ClearNodeData(this);
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}
/* static */
bool
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)

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

@ -8,7 +8,6 @@
#define nsINode_h___
#include "mozilla/Likely.h"
#include "mozilla/ServoTypes.h"
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h" // for member, local
#include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty
@ -186,14 +185,13 @@ enum {
// These two bits are shared by Gecko's and Servo's restyle systems for
// different purposes. They should not be accessed directly, and access to
// them should be properly guarded by asserts.
//
// FIXME(bholley): These should move to Element, and we only need one now.
NODE_SHARED_RESTYLE_BIT_1 = NODE_FLAG_BIT(21),
NODE_SHARED_RESTYLE_BIT_2 = NODE_FLAG_BIT(22),
// Whether this node is dirty for Servo's style system.
NODE_IS_DIRTY_FOR_SERVO = NODE_SHARED_RESTYLE_BIT_1,
// Whether this node has dirty descendants for Servo's style system.
NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO = NODE_SHARED_RESTYLE_BIT_2,
NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO = NODE_SHARED_RESTYLE_BIT_1,
// Remaining bits are node type specific.
NODE_TYPE_SPECIFIC_BITS_OFFSET = 23
@ -981,48 +979,6 @@ public:
bool IsStyledByServo() const { return false; }
#endif
bool IsDirtyForServo() const
{
MOZ_ASSERT(IsStyledByServo());
return HasFlag(NODE_IS_DIRTY_FOR_SERVO);
}
bool HasDirtyDescendantsForServo() const
{
MOZ_ASSERT(IsStyledByServo());
return HasFlag(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void SetIsDirtyForServo() {
MOZ_ASSERT(IsStyledByServo());
SetFlags(NODE_IS_DIRTY_FOR_SERVO);
}
void SetHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
SetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void SetIsDirtyAndHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
SetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO | NODE_IS_DIRTY_FOR_SERVO);
}
void UnsetIsDirtyForServo() {
MOZ_ASSERT(IsStyledByServo());
UnsetFlags(NODE_IS_DIRTY_FOR_SERVO);
}
void UnsetHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
UnsetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO);
}
void UnsetIsDirtyAndHasDirtyDescendantsForServo() {
MOZ_ASSERT(IsStyledByServo());
UnsetFlags(NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO | NODE_IS_DIRTY_FOR_SERVO);
}
inline void UnsetRestyleFlagsIfGecko();
/**
@ -2061,16 +2017,6 @@ public:
#undef TOUCH_EVENT
#undef EVENT
bool HasServoData() {
#ifdef MOZ_STYLO
return !!mServoData.Get();
#else
MOZ_CRASH("Accessing servo node data in non-stylo build");
#endif
}
void ClearServoData();
protected:
static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
static void Unlink(nsINode *tmp);
@ -2108,11 +2054,6 @@ protected:
// Storage for more members that are usually not needed; allocated lazily.
nsSlots* mSlots;
#ifdef MOZ_STYLO
// Per-node data managed by Servo.
mozilla::ServoCell<ServoNodeData*> mServoData;
#endif
};
inline nsIDOMNode* GetAsDOMNode(nsINode* aNode)

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

@ -2942,11 +2942,14 @@ IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell)
return false;
}
// XXXbholley: This could be done more directly with Servo's style system.
StyleSetHandle styleSet = aPresShell->StyleSet();
RefPtr<nsStyleContext> sc;
for (int32_t i = elementsToCheck.Length() - 1; i >= 0; --i) {
if (sc) {
sc = styleSet->ResolveStyleFor(elementsToCheck[i], sc);
sc = styleSet->ResolveStyleFor(elementsToCheck[i], sc,
ConsumeStyleBehavior::DontConsume,
LazyComputeBehavior::Assert);
} else {
sc = nsComputedDOMStyle::GetStyleContextForElementNoFlush(elementsToCheck[i],
nullptr, aPresShell);

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

@ -72,10 +72,9 @@ onconnect = function(event) {
throw new Error("'connect' event has data: " + event.data);
}
// The expression closures should trigger a warning in debug builds, but NOT
// fire error events at us. If we ever actually remove expression closures
// (in bug 1083458), we'll need something else to test this case.
(function() "Expected console warning: expression closures are deprecated");
// Statement after return should trigger a warning, but NOT fire error events
// at us.
(function() { return; 1; });
event.ports[0].onmessage = function(event) {
if (!(event instanceof MessageEvent)) {

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

@ -22,7 +22,7 @@
const sentMessage = "ping";
const errorFilename = href.substring(0, href.lastIndexOf("/") + 1) +
filename;
const errorLine = 91;
const errorLine = 90;
const errorColumn = 0;
var worker = new SharedWorker(filename);

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

@ -426,7 +426,6 @@ nsXBLBinding::GenerateAnonymousContent()
nsIPresShell* presShell = mBoundElement->OwnerDoc()->GetShell();
ServoStyleSet* servoSet = presShell->StyleSet()->GetAsServo();
if (servoSet) {
mBoundElement->SetHasDirtyDescendantsForServo();
servoSet->StyleNewChildren(mBoundElement);
}
}

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

@ -141,21 +141,8 @@ ImageCacheKey::ComputeHash(ImageURL* aURI,
nsAutoCString suffix;
aAttrs.CreateSuffix(suffix);
if (aBlobSerial) {
// For blob URIs, we hash the serial number of the underlying blob, so that
// different blob URIs which point to the same blob share a cache entry. We
// also include the ref portion of the URI to support media fragments which
// requires us to create different Image objects even if the source data is
// the same.
nsAutoCString ref;
aURI->GetRef(ref);
return HashGeneric(*aBlobSerial, HashString(ref + suffix + ptr));
}
// For non-blob URIs, we hash the URI spec.
nsAutoCString spec;
aURI->GetSpec(spec);
return HashString(spec + suffix + ptr);
return AddToHash(0, aURI->ComputeHash(aBlobSerial),
HashString(suffix), HashString(ptr));
}
/* static */ void*

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

@ -9,10 +9,14 @@
#include "nsIURI.h"
#include "MainThreadUtils.h"
#include "nsNetUtil.h"
#include "mozilla/HashFunctions.h"
#include "nsHashKeys.h"
namespace mozilla {
namespace image {
class ImageCacheKey;
/** ImageURL
*
* nsStandardURL is not threadsafe, so this class is created to hold only the
@ -113,6 +117,22 @@ public:
}
private:
friend class ImageCacheKey;
uint32_t ComputeHash(const Maybe<uint64_t>& aBlobSerial) const
{
if (aBlobSerial) {
// For blob URIs, we hash the serial number of the underlying blob, so that
// different blob URIs which point to the same blob share a cache entry. We
// also include the ref portion of the URI to support media fragments which
// requires us to create different Image objects even if the source data is
// the same.
return HashGeneric(*aBlobSerial, HashString(mRef));
}
// For non-blob URIs, we hash the URI spec.
return HashString(mSpec);
}
// Since this is a basic storage class, no duplication of spec parsing is
// included in the functionality. Instead, the class depends upon the
// parsing implementation in the nsIURI class used in object construction.

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

@ -3,7 +3,7 @@ if (typeof SIMD === 'undefined')
Int8x16 = SIMD.Int8x16;
var Int32x4 = SIMD.Int32x4;
function testSwizzleForType(type) type();
function testSwizzleForType(type) { return type(); }
testSwizzleForType(Int8x16);
function testSwizzleInt32x4() testSwizzleForType(Int32x4);
function testSwizzleInt32x4() { return testSwizzleForType(Int32x4); }
testSwizzleInt32x4();

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

@ -10,7 +10,8 @@ var ValueStruct = new T.StructType({
})
var v = new ValueStruct;
new class get extends Number {};
function writeValue(o, v)
o.f = v
function writeValue(o, v) {
return o.f = v;
}
for (var i = 0; i < 5; i++)
writeValue(v, {}, "helo")

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

@ -1,9 +1,9 @@
function f1(a, bIs, cIs, dIs, {b}={b: 3}, c=4, [d]=[5]) (
function f1(a, bIs, cIs, dIs, {b}={b: 3}, c=4, [d]=[5]) {
assertEq(a, 1),
assertEq(b, bIs),
assertEq(c, cIs),
assertEq(d, dIs)
);
}
assertEq(f1.length, 4);
f1(1, 3, 4, 5);
f1(1, 42, 43, 44, {b: 42}, 43, [44]);

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

@ -1,6 +1,6 @@
// See bug 763313
load(libdir + "iteration.js");
function f([a]) a
function f([a]) { return a; }
var i = 0;
var o = {[Symbol.iterator]: function () { i++; return {
next: function () { i++; return {value: 42, done: false}; }}}};

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

@ -58,7 +58,7 @@ assertThrowsInstanceOf(rec, InternalError);
var rec = asmLink(asmCompile(USE_ASM+"function rec(i) { i=i|0; if (!i) return 0; return ((rec((i-1)|0)|0)+1)|0 } return rec"));
assertEq(rec(100), 100);
assertEq(rec(1000), 1000);
assertThrowsInstanceOf(function() rec(100000000000), InternalError);
assertThrowsInstanceOf(() => rec(100000000000), InternalError);
assertEq(rec(2000), 2000);
assertAsmTypeFail(USE_ASM+"function f(){return 0} function g() { var i=0; i=f() } return g");

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

@ -6,6 +6,8 @@ loadFile("");
loadFile(` function lalala() {}
new Map([[1, 2]]).forEach(lalala)
`);
function loadFile(lfVarx) oomTest(function() {
eval(lfVarx)
})
function loadFile(lfVarx) {
return oomTest(function() {
eval(lfVarx)
});
}

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

@ -3,7 +3,7 @@
g = newGlobal();
g.parent = this;
g.eval("(" + function() {
Debugger(parent).onExceptionUnwind = function() 0;
Debugger(parent).onExceptionUnwind = function() { return 0; };
} + ")()");
async function f() {
t;

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

@ -3,5 +3,5 @@
//
(function(){
var x;
eval("var x; ((function ()x)())");
eval("var x; ((function () { return x; })())");
})()

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

@ -4,7 +4,7 @@
function f(foo)
{
var x;
eval("this.__defineGetter__(\"y\", function ()x)");
eval("this.__defineGetter__(\"y\", function () { return x; })");
}
f("");
try {

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

@ -5,9 +5,9 @@ function f(param) {
var w;
return eval("\
(function(){\
this.__defineGetter__(\"y\", function()({\
this.__defineGetter__(\"y\", function() { return ({\
x: function(){ return w }()\
}))\
}); })\
});\
");
}

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

@ -3,7 +3,7 @@
//
function f(a) {
function g() {
yield function () a;
yield function () { return a; };
}
return g();
}

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

@ -2,4 +2,4 @@
// Flags:
//
options('strict')
Function("function y(x,x)d")
Function("function y(x,x) { return d; }")

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

@ -5,5 +5,6 @@
//
AddRegExpCases(/a*b/, "xxx", 0, null );
AddRegExpCases(/x\d\dy/, "abcx45ysss235", 3,[] );
function AddRegExpCases(regexp, pattern, index, matches_array )
(matches_array.length, regexp)
function AddRegExpCases(regexp, pattern, index, matches_array ) {
return (matches_array.length, regexp);
}

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

@ -7,8 +7,8 @@ function TestCase(n, d, e, a) {
this.description=d
gTestcases[gTc++]=this
}
TestCase.prototype.dump=function () + toPrinted(this.description)
function toPrinted(value) value=value;
TestCase.prototype.dump=function () { return + toPrinted(this.description); };
function toPrinted(value) { return value=value; }
function reportCompare (expected, actual, description) {
new TestCase("unknown-test-name", description, expected, actual)
}

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

@ -1,10 +1,11 @@
// Binary: cache/js-opt-32-2dc40eb83023-linux
// Flags: -m -n -a
//
function toPrinted(value)
value = value.replace(/\\n/g, 'NL')
.replace(/\\r/g, 'CR')
.replace(/[^\x20-\x7E]+/g, escapeString);
function toPrinted(value) {
return value = value.replace(/\\n/g, 'NL')
.replace(/\\r/g, 'CR')
.replace(/[^\x20-\x7E]+/g, escapeString);
}
function escapeString (str)
{
var a, b, c, d;

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

@ -4,8 +4,9 @@
gczeal(4);
function startTest() {}
function TestCase(n, d, e, a)
dump = (function () {});
function TestCase(n, d, e, a) {
return dump = (function () {});
}
if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) {}
function writeHeaderToLog( string ) {}
var SECTION = "11.4.5";

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

@ -2,6 +2,6 @@
// Flags:
//
x = Set;
eval("function y()(Iterator)", this);
eval("function y() { return Iterator; }", this);
x.__iterator__ = y;
new Iterator(x)

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

@ -1,4 +1,4 @@
function newFunc(x) Function(x)()
function newFunc(x) { return Function(x)(); }
newFunc(`
var BUGNUMBER = 8[ anonymous = true ]--;
() => BUGNUMBER;

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

@ -4,7 +4,9 @@
// Baseline should not attempt to compile the script.
i = 1;
function test(s) eval("line0 = Error.lineNumber\ndebugger\n" + s);
function test(s) {
return eval("line0 = Error.lineNumber\ndebugger\n" + s);
}
function repeat(s) {
return Array(65 << 13).join(s)
}

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

@ -14,8 +14,9 @@ function printStatus (msg) {
print (STATUS + lines[i]);
}
function printBugNumber (num) {}
function toPrinted(value)
function escapeString (str) {}
function toPrinted(value) {
return function escapeString (str) {};
}
function reportCompare (expected, actual, description) {
var actual_t = typeof actual;
var output = "";
@ -32,9 +33,10 @@ function reportCompare (expected, actual, description) {
return testcase.passed;
}
function reportMatch (expectedRegExp, actual, description) {}
function enterFunc (funcName)
function BigO(data) {
function LinearRegression(data) { }
function enterFunc (funcName) {
return function BigO(data) {
function LinearRegression(data) { }
};
}
function compareSource(expect, actual, summary) {}
function optionsInit() {
@ -44,9 +46,10 @@ function optionsClear() {}
function optionsPush() {}
optionsInit();
optionsClear();
function getTestCaseResult(expected, actual)
function test() {
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
function getTestCaseResult(expected, actual) {
return function test() {
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {}
};
}
var lfcode = new Array();
lfcode.push("4");
@ -62,7 +65,7 @@ addThis();\n\
addThis();\n\
tryThis(1);\n\
function tryThis(x)\n\
addThis();\n\
{ return addThis(); }\n\
test();\n\
function addThis() {\n\
actualvalues[UBound] = actual;\n\

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

@ -1,7 +1,8 @@
setJitCompilerOption("ion.warmup.trigger", 30);
function ArrayCallback(state)
this.state = state;
function ArrayCallback(state) {
return this.state = state;
}
ArrayCallback.prototype.isUpperCase = function(v, index, array) {
return this.state ? true : (v == v.toUpperCase());
};

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

@ -1,6 +1,6 @@
function f(a) {
function g() {
yield function () a;
yield function () { return a; };
}
if (a == 8)
return g();

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

@ -8,6 +8,7 @@ test();
function test() {
[ {0xBe: /l/|| 'Error' ? s++ : summary } ]
}
function foo(code)
Function(code)();
function foo(code) {
return Function(code)();
}
foo("for each (y in this);");

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

@ -26,7 +26,7 @@ function f2() {
x
} = x, (x._)
function
x()({})
x(){ return ({}); }
}
try { f2(); } catch (e) {}

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

@ -1,5 +1,5 @@
function reportCompare(expected, actual, description) + ++actual + "'";
function reportCompare(expected, actual, description) { return + ++actual + "'"; }
var summary = 'Object.prototype.toLocaleString() should track Object.prototype.toString() ';
var o = {
toString: function () {}

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

@ -13,7 +13,7 @@ try {
valueOf: gc
} - [])
} catch (prop) {}
function addThis() reportCompare(expect, actual, 'ok');
function addThis() { return reportCompare(expect, actual, 'ok'); }
Object.defineProperty(Object.prototype, "name", {
set: function (newValue) {}
});

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

@ -1,5 +1,5 @@
Function.prototype.toString = function () f(this, true);
Function.prototype.toString = function () { return f(this, true); };
function f(obj) {
f.caller.p
}

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

@ -13,8 +13,9 @@ function reportCompare (expected, actual, description) {
var testcase = new TestCase("unknown-test-name", description, expected, actual);
reportFailure (description + " : " + output);
}
function enterFunc (funcName)
callStack.push(funcName);
function enterFunc (funcName) {
return callStack.push(funcName);
}
try {
reportCompare(expectCompile, actualCompile,
summary + ': compile actual');

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

@ -40,7 +40,7 @@ try {
try {
var f = function() {
{
print(new function(q)("", s))
print(new function(q) { return ("", s); })
let u
}
};

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

@ -47,7 +47,7 @@ function check(b, desc) {
assertEq(Object.getPrototypeOf(a), ca == "[object Object]" ? Object.prototype : Array.prototype, path)
pb = ownProperties(b).filter(isCloneable)
pa = ownProperties(a)
function byName(a, b) 0
function byName(a, b) { return 0; }
byName
(pa.length, pb.length, "should see the same number of properties " + path)
for (var i = 0; i < pa.length; i++) {

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

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
this.reason = '';
function TestCase(n, d, e, a) {
return this.reason = '';
}
function reportCompare (expected, actual, description) {
var output = "";
var testcase = new TestCase("unknown-test-name", description, expected, actual);

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

@ -6,6 +6,6 @@ function test(str, f) {\
var x = f(eval(str));\
assertEq(x, f(g1.eval(str)));\
}\
test('new RegExp(\"1\")', function(r) assertEq('a1'.search(r), 1));\
test('new RegExp(\"1\")', function(r) { return assertEq('a1'.search(r), 1); });\
" + " })();");
eval("(function() { " + "" + " })();");

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

@ -4,5 +4,5 @@ function foo(x, y) {
this.g = x + y;
}
var a = 0;
var b = { valueOf: function() Object.defineProperty(Object.prototype, 'g', {}) };
var b = { valueOf: function() { return Object.defineProperty(Object.prototype, 'g', {}); } };
var c = new foo(a, b);

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

@ -2,5 +2,5 @@ function example(a, b, c) {
var complicated = 3;
perform_some_operations();
}
var myfun = function (a, b) a + b;
var myfun = function (a, b) { return a + b; }
assertEq(decompileThis(), snarf(thisFilename()));

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

@ -1,7 +1,7 @@
var o = {get prop() a + b, set prop(x) a + b};
var o = {get prop() { a + b; }, set prop(x) { a + b; }};
var prop = Object.getOwnPropertyDescriptor(o, "prop");
assertEq(prop.get.toString(), "function get prop() a + b");
assertEq(prop.get.toSource(), "(function get prop() a + b)");
assertEq(prop.set.toString(), "function set prop(x) a + b");
assertEq(prop.set.toSource(), "(function set prop(x) a + b)");
assertEq(o.toSource(), "({get prop () a + b, set prop (x) a + b})");
assertEq(prop.get.toString(), "function get prop() { a + b; }");
assertEq(prop.get.toSource(), "(function get prop() { a + b; })");
assertEq(prop.set.toString(), "function set prop(x) { a + b; }");
assertEq(prop.set.toSource(), "(function set prop(x) { a + b; })");
assertEq(o.toSource(), "({get prop () { a + b; }, set prop (x) { a + b; }})");

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

@ -43,17 +43,17 @@ function shapelessCalleeTest()
{
var a = [];
var helper = function (i, a) a[i] = i;
shapelessArgCalleeLoop(helper, helper, function (i, a) a[i] = -i, a);
var helper = function (i, a) { a[i] = i; };
shapelessArgCalleeLoop(helper, helper, function (i, a) { a[i] = -i; }, a);
helper = function (i, a) a[10 + i] = i;
shapelessVarCalleeLoop(helper, helper, function (i, a) a[10 + i] = -i, a);
helper = function (i, a) { a[10 + i] = i; };
shapelessVarCalleeLoop(helper, helper, function (i, a) { a[10 + i] = -i; }, a);
helper = function (i, a) a[20 + i] = i;
shapelessLetCalleeLoop(helper, helper, function (i, a) a[20 + i] = -i, a);
helper = function (i, a) { a[20 + i] = i; };
shapelessLetCalleeLoop(helper, helper, function (i, a) { a[20 + i] = -i; }, a);
helper = function (i, a) a[30 + i] = i;
shapelessUnknownCalleeLoop(null, helper, helper, function (i, a) a[30 + i] = -i, a);
helper = function (i, a) { a[30 + i] = i; };
shapelessUnknownCalleeLoop(null, helper, helper, function (i, a) { a[30 + i] = -i; }, a);
try {
helper = {hack: 42};

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

@ -53,7 +53,7 @@ function checkNormal(f) {
assertEqArray(f.apply(null, ...[[undefined]]), [undefined, undefined, undefined]);
}
checkNormal(function(a, b, c) [a, b, c]);
checkNormal(function(a, b, c) { return [a, b, c]; });
checkNormal((a, b, c) => [a, b, c]);
function checkDefault(f) {
@ -67,7 +67,7 @@ function checkDefault(f) {
assertEqArray(f.apply(null, ...[[undefined]]), [-1, -2, -3]);
}
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c]);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; });
checkDefault((a = -1, b = -2, c = -3) => [a, b, c]);
function checkRest(f) {
@ -84,5 +84,5 @@ function checkRest(f) {
assertEqArray(f.apply(null, ...new Map([[["a", "A"], ["b", "B"]]])).map(([k, v]) => k + v), ["aA", "bB"]);
}
checkRest(function(...x) x);
checkRest(function(...x) { return x; });
checkRest((...x) => x);

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

@ -7,5 +7,5 @@ function check(f) {
assertEqArray(f.call(...[null, 1, ...[2, 3], 4, ...[5, 6]]), [1, 2, 3, 4, 5, 6]);
}
check(function(...x) x);
check(function(...x) { return x; });
check((...x) => x);

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

@ -44,8 +44,8 @@ function checkLength(f, makeFn) {
assertEq(makeFn("...arg")(f, gen()), 3);
}
checkLength(function(x) arguments.length, makeCall);
checkLength(function(x) arguments.length, makeFunCall);
checkLength(function(x) { return arguments.length; }, makeCall);
checkLength(function(x) { return arguments.length; }, makeFunCall);
function lengthClass(x) {
this.length = arguments.length;
}

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

@ -14,13 +14,13 @@ var foo = {}
foo[Symbol.iterator] = 10;
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() undefined;
foo[Symbol.iterator] = function() { return undefined; };
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() this;
foo[Symbol.iterator] = function() { return this; };
assertThrowsInstanceOf(() => Math.sin(...foo), TypeError);
foo[Symbol.iterator] = function() this;
foo[Symbol.iterator] = function() { return this; };
foo.next = function() { throw 10; };
assertThrowsValue(() => Math.sin(...foo), 10);

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

@ -9,9 +9,9 @@ function check(f) {
}
}
let f = function() f(...a) + 1;
let f = function() { return f(...a) + 1; };
let g = () => g(...a) + 1;
let h = function() new h(...a) + 1;
let h = function() { return new h(...a) + 1; };
check(f);
check(g);

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

@ -57,8 +57,8 @@ function checkNormal(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [undefined, undefined, undefined]);
}
checkNormal(function(a, b, c) [a, b, c], makeCall);
checkNormal(function(a, b, c) [a, b, c], makeFunCall);
checkNormal(function(a, b, c) { return [a, b, c]; }, makeCall);
checkNormal(function(a, b, c) { return [a, b, c]; }, makeFunCall);
checkNormal((a, b, c) => [a, b, c], makeCall);
checkNormal((a, b, c) => [a, b, c], makeFunCall);
function normalClass(a, b, c) {
@ -78,8 +78,8 @@ function checkDefault(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [-1, -2, -3]);
}
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c], makeCall);
checkDefault(function(a = -1, b = -2, c = -3) [a, b, c], makeFunCall);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; }, makeCall);
checkDefault(function(a = -1, b = -2, c = -3) { return [a, b, c]; }, makeFunCall);
checkDefault((a = -1, b = -2, c = -3) => [a, b, c], makeCall);
checkDefault((a = -1, b = -2, c = -3) => [a, b, c], makeFunCall);
function defaultClass(a = -1, b = -2, c = -3) {
@ -99,8 +99,8 @@ function checkRest(f, makeFn) {
assertEqArray(makeFn("...[undefined]")(f), [undefined]);
}
checkRest(function(...x) x, makeCall);
checkRest(function(...x) x, makeFunCall);
checkRest(function(...x) { return x; }, makeCall);
checkRest(function(...x) { return x; }, makeFunCall);
checkRest((...x) => x, makeCall);
checkRest((...x) => x, makeFunCall);
function restClass(...x) {

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

@ -1,12 +1,12 @@
const C = function (a, b, c) {
return function C() {
this.m1 = function () a;
this.m2 = function () b;
this.m3 = function () c;
this.m1 = function () { return a; };
this.m2 = function () { return b; };
this.m3 = function () { return c; };
}
}(2,3,4);
var c = new C();
var d = function (e) {return {m0: function () e}}(5);
var d = function (e) {return {m0: function () { return e; }}}(5);
for (var i = 0; i < 5; i++)
d.m0();
C.call(d);

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

@ -1,6 +1,7 @@
function g1() {}
function g2()
function Int8Array () {}
function g2() {
return function Int8Array () {};
}
function f1(other) {
eval("gc(); h = g1");
for(var i=0; i<20; i++) {

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

@ -1 +1 @@
assertEq((function(x, y, x) { return (function() x+y)(); })(1,2,5), 7);
assertEq((function(x, y, x) { return (function() { return x+y; })(); })(1,2,5), 7);

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

@ -3,7 +3,7 @@ function testCallProtoMethod() {
X.prototype.getName = function () { return "X"; }
function Y() { this.x = 2; }
Y.prototype.getName = function() "Y";
Y.prototype.getName = function() { return "Y"; };
var a = [new X, new X, new X, new X, new Y];
var s = '';

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

@ -4,9 +4,9 @@ assertEq((function() { var x; x = 3; return (function() { return x } )() })(), 3
assertEq((function() { x = 3; var x; return (function() { return x } )() })(), 3);
assertEq((function() { var x; var g = function() { return x }; x = 3; return g() })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return (function() f())() })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return (function() { return f(); })(); })(), 3);
assertEq((function() { function f() { return 3 }; assertEq(f(), 3); return eval('f()') })(), 3);
assertEq((function() { function f() { return 3 }; (function() f())(); return f() })(), 3);
assertEq((function() { function f() { return 3 }; (function() { return f(); })(); return f() })(), 3);
assertEq((function() { var x = 3; return eval("x") })(), 3);
assertEq((function() { var x; x = 3; return eval("x") })(), 3);
@ -26,39 +26,39 @@ assertEq((function(x) { return eval("x") })(3), 3);
assertEq((function(x) { x = 3; return eval("x") })(4), 3);
assertEq((function(a) { var [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { var [[l, x],[m, y]] = a; x += y; return (function() x)() })([[0,1],[0,2]]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a) { var [[l, x],[m, y]] = a; x += y; return (function() { return x; })() })([[0,1],[0,2]]), 3);
assertEq((function(a) { var [x,y] = a; eval('x += y'); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return eval('x') })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { var [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; (function() { eval('x += y') })(); return x })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; x += y; return (function() eval('x'))() })([1,2]), 3);
assertEq((function(a,x,y) { [x,y] = a; x += y; return (function() { return eval('x'); })() })([1,2]), 3);
assertEq((function() { var [x,y] = [1,2]; x += y; return (function() x)() })(), 3);
assertEq((function() { var [x,y] = [1,2]; (function() x += y)(); return x })(), 3);
assertEq((function() { { let [x,y] = [1,2]; x += y; return (function() x)() } })(), 3);
assertEq((function() { { let [x,y] = [1,2]; (function() x += y)(); return x } })(), 3);
assertEq((function() { var [x,y] = [1,2]; x += y; return (function() { return x; })() })(), 3);
assertEq((function() { var [x,y] = [1,2]; (function() { return x += y; })(); return x })(), 3);
assertEq((function() { { let [x,y] = [1,2]; x += y; return (function() { return x; })() } })(), 3);
assertEq((function() { { let [x,y] = [1,2]; (function() { return x += y; })(); return x } })(), 3);
assertEq((function([x,y]) { (function() { x += y })(); return x })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() x)() })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function([[l,x],[m,y]]) { (function() { x += y })(); return x })([[0,1],[0,2]]), 3);
assertEq((function([[l,x],[m,y]]) { x += y; return (function() x)() })([[0,1],[0,2]]), 3);
assertEq((function([[l,x],[m,y]]) { x += y; return (function() { return x; })() })([[0,1],[0,2]]), 3);
assertEq((function([x,y]) { (function() { eval('x += y') })(); return x })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() eval('x'))() })([1,2]), 3);
assertEq((function([x,y]) { x += y; return (function() { return eval('x'); })() })([1,2]), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { eval('x += y'); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return eval('x') }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { (function() { x += y })(); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() x)() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() { return x; })() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { (function() { eval('x += y') })(); return x }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() eval('x'))() }})(), 3);
assertEq((function() { try { throw [1,2] } catch([x,y]) { x += y; return (function() { return eval('x'); })() }})(), 3);
assertEq((function(a) { let [x,y] = a; (function() { x += y })(); return x })([1,2]), 3);
assertEq((function(a) { let [x,y] = a; x += y; return (function() x)() })([1,2]), 3);
assertEq((function(a) { let [x,y] = a; x += y; return (function() { return x; })() })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; (function() { x += y })(); return x } })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; x += y; return (function() x)() } })([1,2]), 3);
assertEq((function(a) { { let [x,y] = a; x += y; return (function() { return x; })() } })([1,2]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; (function() { x += y })(); return x } })([[0,1],[0,2]]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; x += y; return (function() x)() } })([[0,1],[0,2]]), 3);
assertEq((function(a) { { let [[l, x],[m, y]] = a; x += y; return (function() { return x; })() } })([[0,1],[0,2]]), 3);
assertEq((function() { let x = 3; return (function() { return x })() })(), 3);
assertEq((function() { let g = function() { return x }; let x = 3; return g() })(), 3);
@ -69,7 +69,7 @@ assertEq((function() { { let x = 2; x = 3; return (function() { return x })() }
assertEq((function() { { let x = 1; { let x = 3; (function() { assertEq(x,3) })() } return x } })(), 1);
assertEq((function() { try { throw 3 } catch (e) { (function(){assertEq(e,3)})(); return e } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { assertEq(e, 3); return (function() e)() } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { assertEq(e, 3); return (function() { return e; })() } })(), 3);
assertEq((function() { try { throw 3 } catch (e) { (function(){eval('assertEq(e,3)')})(); return e } })(), 3);
assertEq((function() { var x; function f() { return x } function f() { return 3 }; return f() })(), 3);

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

@ -20,8 +20,9 @@ var dbg = new Debugger(g1, g2, g3);
function script(func) {
var gw = dbg.addDebuggee(func.global);
var script = gw.makeDebuggeeValue(func).script;
script.toString = function ()
"[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
script.toString = function () {
return "[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
};
return script;
}

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

@ -1,7 +1,7 @@
gczeal(2);
g = newGlobal();
dbg = Debugger(g);
dbg.onNewScript = function() function() this;
dbg.onNewScript = function() { return function() { return this; } };
schedulegc(10);
g.eval("setLazyParsingDisabled(true)");
g.evaluate("function one() {}");

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

@ -15,7 +15,7 @@ if (!('oomAfterAllocations' in this))
setBreakpoint;
}
}
g.eval("" + function f(d) toggle(d))
g.eval("" + function f(d) { return toggle(d); })
g.eval("(" + function() {
f(false);
f(true);

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

@ -13,7 +13,7 @@ file = lfcode.shift();
loadFile(file);
function loadFile(lfVarx) {
try {
function newFunc(x) Function(x)();
function newFunc(x) { return Function(x)(); }
newFunc(lfVarx)();
} catch (lfVare) {
print(lfVare)

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

@ -3,7 +3,7 @@
g = newGlobal();
dbg = Debugger(g);
hits = 0;
dbg.onNewScript = function () hits++;
dbg.onNewScript = function () { return hits++; };
assertEq(g.eval("eval('2 + 3')"), 5);
this.gczeal(hits,1);
dbg = Debugger(g);

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

@ -20,7 +20,7 @@ function check(expr, expected = expr) {
for ([end, err] of[[".random_prop", " is undefined" ]])
statement = "o = {};" + expr + end;
cases = [
function() ieval("var undef;" + statement),
function() { return ieval("var undef;" + statement); },
Function(statement)
]
for (f of cases)

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

@ -1,7 +1,8 @@
// |jit-test| error:ReferenceError
toPrinted(this.reason);
function toPrinted(value)
value = String(value);
function toPrinted(value) {
return value = String(value);
}
var lfcode = new Array();
lfcode.push = loadFile;
lfcode.push("enableTrackAllocations();");

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

@ -8,8 +8,9 @@ var evalInFrame = (function (global) {
})(this);
var gTestcases = new Array();
var gTc = gTestcases.length;
function TestCase()
gTestcases[gTc++] = this;
function TestCase() {
return gTestcases[gTc++] = this;
}
function checkCollation(extensionCoValue, usageValue) {
var collator = new Intl.Collator(["de-DE"]);
collator.resolvedOptions().collation;

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

@ -5,8 +5,9 @@ var g = newGlobal();
gczeal(10, 2)
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame1) {
function hit(frame2)
hit[0] = "mutated";
function hit(frame2) {
return hit[0] = "mutated";
}
var s = frame1.script;
var offs = s.getLineOffsets(g.line0 + 2);
for (var i = 0; i < offs.length; i++)

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

@ -15,7 +15,7 @@ function foo() {
LineType = new TO.StructType({
PointType
})
function testBasic() new LineType;
function testBasic() { return new LineType; }
testBasic();
}
evaluate("foo()");

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

@ -2,9 +2,9 @@ if (!('oomTest' in this))
quit();
print = function() {}
function k() dissrc(print);
function j() k();
function h() j();
function f() h();
function k() { return dissrc(print); }
function j() { return k(); }
function h() { return j(); }
function f() { return h(); }
f();
oomTest(() => f())

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

@ -4,5 +4,6 @@ if (!('oomTest' in this))
lfLogBuffer = `this[''] = function() {}`;
loadFile(lfLogBuffer);
loadFile(lfLogBuffer);
function loadFile(lfVarx)
oomTest(function() parseModule(lfVarx))
function loadFile(lfVarx) {
return oomTest(function() { return parseModule(lfVarx); });
}

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

@ -15,8 +15,8 @@ evalcx("\
g.h = function() {\
g.oomAfterAllocations(1);\
};\
g.eval(\"\" + function f() g());\
g.eval(\"\" + function g() h());\
g.eval(\"\" + function f() { return g(); });\
g.eval(\"\" + function g() { return h(); });\
g.eval(\"(\" + function() {\
f();\
} + \")()\");\

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

@ -12,7 +12,7 @@ for (var i = 0; i < 4; ++i) {
function f1() {}
}
Object.defineProperty(a, 12, {}).push(1);
toString = (function() a.reverse())
toString = (function() { return a.reverse(); })
oomTest(Date.prototype.toJSON)
function f1000(){}
function f1001(){}

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

@ -1,7 +1,7 @@
// |jit-test| need-for-each
a2 = []
g = function() r
g = function() { return r; };
Object.defineProperty(a2, 0, {
set: function() {}
})

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

@ -4,7 +4,7 @@ function TestCase(n) {
}
gczeal(7,1);
eval("\
function reportCompare() new TestCase;\
function reportCompare() { return new TestCase; };\
reportCompare();\
Object.defineProperty(Object.prototype, 'name', {});\
reportCompare();\

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

@ -7,7 +7,7 @@ function TestCase(n) {
this.reason = '';
this.passed = '';
}
function test() new TestCase;
function test() { return new TestCase; }
test();
Object.defineProperty(Object.prototype, "name", {});
test();

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

@ -4,7 +4,7 @@ gczeal(2,300);
evaluate("\
var toFloat32 = (function() {\
var f32 = new Float32Array(1);\
function f(x) f32[0] = x;\
function f(x) { return f32[0] = x; }\
return f;\
})();\
for (var i = 0; i < 64; ++i) {\

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

@ -1,7 +1,7 @@
var NotEarlyErrorString = "NotEarlyError";
var NotEarlyError = new Error(NotEarlyErrorString);
var juneDate = new Date(2000, 5, 20, 0, 0, 0, 0);
for (var i = 0; i < function(x) myObj(Date.prototype.toString.apply(x)); void i) {
for (var i = 0; i < function(x) { return myObj(Date.prototype.toString.apply(x)); }; void i) {
eval(a.text.replace(/@/g, ""))
}
gcslice(2601);

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

@ -1,4 +1,4 @@
if (!('oomTest' in this))
quit();
oomTest(function() 1e300)
oomTest(function() { return 1e300; })

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

@ -12,7 +12,7 @@ function loadFile(lfVarx) {
if (lfVarx.length != 1)
switch (lfRunTypeId) {
case 3:
function newFunc(x) Function(x)()
function newFunc(x) { return Function(x)(); }
newFunc(lfVarx)
case 5:
for (lfLocal in this);

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

@ -10,8 +10,9 @@ loadFile(`
whatever.push;
}
testGC(o)
function writeObject()
o.f = v
function writeObject() {
return o.f = v;
}
writeObject({function() { } })
for (var i ; i < 5 ; ++i)
try {} catch (StringStruct) {}

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

@ -11,5 +11,5 @@ loadFile(`
SwitchTest();
`)
function loadFile(lfVarx) {
oomTest(function() eval(lfVarx))
oomTest(function() { return eval(lfVarx); })
}

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

@ -16,8 +16,8 @@ function h() {
evalInFrame(0, "a.push")
evalInFrame(1, "a.pushy")
}
function g() h()
function f() g()
function g() { return h(); }
function f() { return g(); }
f()
evaluate(`
g()

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

@ -1,4 +1,4 @@
function reportCompare(actual) - ++actual + "'";
function reportCompare(actual) { return - ++actual + "'"; }
var UBound = 0;
var actualvalues = [];
for (var li = 0; li < 6; ++li) addThis();

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

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "15.1.2.5-2";
for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
new TestCase( SECTION, unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );

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

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "11.7.2";
for ( power = 0; power <= 32; power++ ) {
shiftexp = Math.pow( 2, power );

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

@ -8,7 +8,7 @@ function YearFromTime(t) {
}
function MonthFromTime(t) {
DayWithinYear(t)
function DayWithinYear(t) Day(t) - YearFromTime()
function DayWithinYear(t) { return Day(t) - YearFromTime(); }
function WeekDay(t) {
weekday = Day(t) + 4
return (weekday < 0 ? weekday : weekday);

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

@ -2,8 +2,9 @@ var OMIT = {};
var WRITABLES = [true, false, OMIT];
{
var desc = {};
function put(field, value)
desc[field] = value;
function put(field, value) {
return desc[field] = value;
}
WRITABLES.forEach(function(writable) {
put("writable", writable)
});

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

@ -1,5 +1,6 @@
function TestCase(n, d, e, a)
function writeHeaderToLog( string ) {}
function TestCase(n, d, e, a) {
return function writeHeaderToLog( string ) {};
}
var SECTION = "15.1.2.4";
for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
new TestCase( SECTION, "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)));

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше