560ce080fe
... timeout in the big websnapshot tests. Bug: v8:12891 Change-Id: I7837ba985f835e20af294ea0206dfafb5def7619 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3660705 Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: 王澳 <wangao.james@bytedance.com> Cr-Commit-Position: refs/heads/main@{#80713}
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --experimental-d8-web-snapshot-api --allow-natives-syntax
|
|
|
|
'use strict';
|
|
|
|
d8.file.execute('test/mjsunit/web-snapshot/web-snapshot-helpers.js');
|
|
|
|
(function TestBuiltin() {
|
|
function createObjects() {
|
|
globalThis.obj1 = {'a': Error};
|
|
globalThis.obj2 = {'b': Error.prototype};
|
|
}
|
|
const realm = Realm.create();
|
|
const {obj1, obj2} = takeAndUseWebSnapshot(
|
|
createObjects, ['obj1', 'obj2'], realm);
|
|
assertTrue(obj1.a === Realm.eval(realm, "Error"));
|
|
assertTrue(obj2.b === Realm.eval(realm, "Error.prototype"));
|
|
})();
|
|
|
|
(function TestInheritFromBuiltin() {
|
|
function createObjects() {
|
|
function inherit(subclass, superclass) {
|
|
function middle() {}
|
|
middle.prototype = superclass.prototype;
|
|
subclass.prototype = new middle();
|
|
subclass.prototype.constructor = subclass;
|
|
};
|
|
function MyError() {}
|
|
inherit(MyError, Error);
|
|
globalThis.MyError = MyError;
|
|
}
|
|
const realm = Realm.create();
|
|
const {MyError} = takeAndUseWebSnapshot(createObjects, ['MyError'], realm);
|
|
const obj = new MyError();
|
|
assertTrue(obj.__proto__.__proto__ === Realm.eval(realm, "Error.prototype"));
|
|
})();
|