Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
Local<Context> context = isolate->GetCurrentContext();
- Local<Value> this_value;
if (args.Length() < 1) {
Throw(isolate, "Invalid argument");
return;
}
- if (args.This()->InternalFieldCount() > 0) {
- this_value = args.This()->GetInternalField(0);
- }
- if (this_value.IsEmpty()) {
+ Local<Value> this_value = args.This()->GetInternalField(0);
+ if (!this_value->IsExternal()) {
Throw(isolate, "this is not a Worker");
return;
}
void Shell::WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
- Local<Value> this_value;
- if (args.This()->InternalFieldCount() > 0) {
- this_value = args.This()->GetInternalField(0);
- }
- if (this_value.IsEmpty()) {
+
+ Local<Value> this_value = args.This()->GetInternalField(0);
+ if (!this_value->IsExternal()) {
Throw(isolate, "this is not a Worker");
return;
}
void Shell::WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
- Local<Value> this_value;
- if (args.This()->InternalFieldCount() > 0) {
- this_value = args.This()->GetInternalField(0);
- }
- if (this_value.IsEmpty()) {
+ Local<Value> this_value = args.This()->GetInternalField(0);
+ if (!this_value->IsExternal()) {
Throw(isolate, "this is not a Worker");
return;
}
+++ /dev/null
-// 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.
-
-// Throw rather than overflow internal field index
-
-assertThrows(function() {
- Worker.prototype.terminate();
-});
-
-assertThrows(function() {
- Worker.prototype.getMessage();
-});
-
-assertThrows(function() {
- Worker.prototype.postMessage({});
-});
-
-// Don't throw for real worker
-
-var worker = new Worker('');
-worker.getMessage();
-worker.postMessage({});
-worker.terminate();