OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 { | 86 { |
87 if (value.IsEmpty() || !value->IsObject()) | 87 if (value.IsEmpty() || !value->IsObject()) |
88 return false; | 88 return false; |
89 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 89 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
90 | 90 |
91 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) | 91 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) |
92 return false; | 92 return false; |
93 | 93 |
94 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); | 94 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); |
95 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); | 95 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); |
| 96 if (!(untrustedWrapperTypeInfo && perIsolateData)) |
| 97 return false; |
96 return perIsolateData->hasInstance(untrustedWrapperTypeInfo, object); | 98 return perIsolateData->hasInstance(untrustedWrapperTypeInfo, object); |
97 } | 99 } |
98 | 100 |
99 bool V8DOMWrapper::hasInternalFieldsSet(v8::Local<v8::Value> value) | 101 bool V8DOMWrapper::hasInternalFieldsSet(v8::Local<v8::Value> value) |
100 { | 102 { |
101 if (value.IsEmpty() || !value->IsObject()) | 103 if (value.IsEmpty() || !value->IsObject()) |
102 return false; | 104 return false; |
103 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 105 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
104 | 106 |
105 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) | 107 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) |
106 return false; | 108 return false; |
107 | 109 |
108 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); | 110 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); |
109 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); | 111 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); |
110 return untrustedScriptWrappable | 112 return untrustedScriptWrappable |
111 && untrustedWrapperTypeInfo | 113 && untrustedWrapperTypeInfo |
112 && untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; | 114 && untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; |
113 } | 115 } |
114 | 116 |
115 } // namespace blink | 117 } // namespace blink |
OLD | NEW |