Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: Source/bindings/v8/V8Utilities.cpp

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // Validate the passed array of transferrables. 86 // Validate the passed array of transferrables.
87 for (unsigned int i = 0; i < length; ++i) { 87 for (unsigned int i = 0; i < length; ++i) {
88 v8::Local<v8::Value> transferrable = transferrables->Get(i); 88 v8::Local<v8::Value> transferrable = transferrables->Get(i);
89 // Validation of non-null objects, per HTML5 spec 10.3.3. 89 // Validation of non-null objects, per HTML5 spec 10.3.3.
90 if (isUndefinedOrNull(transferrable)) { 90 if (isUndefinedOrNull(transferrable)) {
91 exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ? "'undefined'" : "'null'") + " value."); 91 exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ? "'undefined'" : "'null'") + " value.");
92 return false; 92 return false;
93 } 93 }
94 // Validation of Objects implementing an interface, per WebIDL spec 4.1. 15. 94 // Validation of Objects implementing an interface, per WebIDL spec 4.1. 15.
95 if (V8MessagePort::hasInstance(transferrable, isolate, worldType(isolate ))) { 95 if (V8MessagePort::hasInstance(transferrable, isolate)) {
96 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob ject>::Cast(transferrable)); 96 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob ject>::Cast(transferrable));
97 // Check for duplicate MessagePorts. 97 // Check for duplicate MessagePorts.
98 if (ports.contains(port)) { 98 if (ports.contains(port)) {
99 exceptionState.throwDOMException(DataCloneError, "Message port a t index " + String::number(i) + " is a duplicate of an earlier port."); 99 exceptionState.throwDOMException(DataCloneError, "Message port a t index " + String::number(i) + " is a duplicate of an earlier port.");
100 return false; 100 return false;
101 } 101 }
102 ports.append(port.release()); 102 ports.append(port.release());
103 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate, worldType( isolate))) { 103 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) {
104 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle <v8::Object>::Cast(transferrable)); 104 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle <v8::Object>::Cast(transferrable));
105 if (arrayBuffers.contains(arrayBuffer)) { 105 if (arrayBuffers.contains(arrayBuffer)) {
106 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); 106 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer.");
107 return false; 107 return false;
108 } 108 }
109 arrayBuffers.append(arrayBuffer.release()); 109 arrayBuffers.append(arrayBuffer.release());
110 } else { 110 } else {
111 exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " does not have a transferable type."); 111 exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " does not have a transferable type.");
112 return false; 112 return false;
113 } 113 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 { 187 {
188 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); 188 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction();
189 if (boundFunction->IsFunction()) { 189 if (boundFunction->IsFunction()) {
190 return v8::Handle<v8::Function>::Cast(boundFunction); 190 return v8::Handle<v8::Function>::Cast(boundFunction);
191 } else { 191 } else {
192 return function; 192 return function;
193 } 193 }
194 } 194 }
195 195
196 } // namespace WebCore 196 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8PerIsolateData.cpp ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698