[d8 Workers] Throw when calling Worker constructor without new
BUG=4399 R=jarin@chromium.org LOG=n Review URL: https://codereview.chromium.org/1260813008 Cr-Commit-Position: refs/heads/master@{#30016}
This commit is contained in:
parent
53be2063cc
commit
890c4d9dc6
@ -699,6 +699,11 @@ void Shell::WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!args.IsConstructCall()) {
|
||||||
|
Throw(args.GetIsolate(), "Worker must be constructed with new");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
base::LockGuard<base::Mutex> lock_guard(workers_mutex_.Pointer());
|
base::LockGuard<base::Mutex> lock_guard(workers_mutex_.Pointer());
|
||||||
// Initialize the internal field to NULL; if we return early without
|
// Initialize the internal field to NULL; if we return early without
|
||||||
|
8
test/mjsunit/regress-4399.js
Normal file
8
test/mjsunit/regress-4399.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright 2015 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.
|
||||||
|
|
||||||
|
|
||||||
|
if (this.Worker) {
|
||||||
|
assertThrows(function() { Worker.prototype.constructor("55"); });
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user