Skip to content

Commit 4e5e7bb

Browse files
committed
Set global object's prototype
The global object should have the same prototype as a simple object. JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]
1 parent e154156 commit 4e5e7bb

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

jerry-core/ecma/builtin-objects/ecma-builtins.inc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ BUILTIN (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR,
301301
/* The Global object (15.1) */
302302
BUILTIN (ECMA_BUILTIN_ID_GLOBAL,
303303
ECMA_OBJECT_TYPE_GENERAL,
304-
ECMA_BUILTIN_ID__COUNT /* no prototype */,
304+
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, /* Implementation-dependent */
305305
true,
306306
true,
307307
global)

tests/jerry/global.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2015 Samsung Electronics Co., Ltd.
2+
// Copyright 2015 University of Szeged.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
17+
assert (this.hasOwnProperty !== undefined);

tests/jerry/regression-test-issue-122.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

1616
try
1717
{
18-
print(this, []);
18+
print({toString: function() { throw new TypeError("foo"); }}, []);
1919
assert (false);
2020
}
2121
catch (e)
2222
{
2323
assert (e instanceof TypeError);
24+
assert (e.message === "foo");
2425
}

0 commit comments

Comments
 (0)