mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
DataView object underlying ArrayBuffer should be marked during GC. (#2849)
This patch fixes #2848 and fixes #2850 as well. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
parent
372ebd8260
commit
eb993d57ed
@ -296,6 +296,14 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW)
|
||||
case LIT_MAGIC_STRING_DATAVIEW_UL:
|
||||
{
|
||||
ecma_dataview_object_t *dataview_p = (ecma_dataview_object_t *) object_p;
|
||||
ecma_gc_set_object_visited (dataview_p->buffer_p);
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) */
|
||||
default:
|
||||
{
|
||||
break;
|
||||
|
||||
17
tests/jerry/es2015/regression-test-issue-2848.js
Normal file
17
tests/jerry/es2015/regression-test-issue-2848.js
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var arrayBuffer = new ArrayBuffer;
|
||||
var dataView = new DataView(arrayBuffer);
|
||||
assert (dataView.buffer === arrayBuffer);
|
||||
26
tests/jerry/es2015/regression-test-issue-2850.js
Normal file
26
tests/jerry/es2015/regression-test-issue-2850.js
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
try {
|
||||
(function () {
|
||||
var d = new DataView(new ArrayBuffer())
|
||||
for (var $; ;) {
|
||||
d.setInt8(0)
|
||||
}
|
||||
})()
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e instanceof RangeError);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user