| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) | 82 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) |
| 83 return false; | 83 return false; |
| 84 | 84 |
| 85 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); | 85 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); |
| 86 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); | 86 V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); |
| 87 if (!(untrustedWrapperTypeInfo && perIsolateData)) | 87 if (!(untrustedWrapperTypeInfo && perIsolateData)) |
| 88 return false; | 88 return false; |
| 89 return perIsolateData->hasInstance(untrustedWrapperTypeInfo, object); | 89 return perIsolateData->hasInstance(untrustedWrapperTypeInfo, object); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void V8DOMWrapper::clearNativeInfo(v8::Isolate* isolate, |
| 93 v8::Local<v8::Object> wrapper) { |
| 94 DCHECK_GE(wrapper->InternalFieldCount(), 2); |
| 95 int indices[] = {v8DOMWrapperObjectIndex, v8DOMWrapperTypeIndex}; |
| 96 void* values[] = {nullptr, nullptr}; |
| 97 wrapper->SetAlignedPointerInInternalFields(WTF_ARRAY_LENGTH(indices), indices, |
| 98 values); |
| 99 } |
| 100 |
| 92 bool V8DOMWrapper::hasInternalFieldsSet(v8::Local<v8::Value> value) { | 101 bool V8DOMWrapper::hasInternalFieldsSet(v8::Local<v8::Value> value) { |
| 93 if (value.IsEmpty() || !value->IsObject()) | 102 if (value.IsEmpty() || !value->IsObject()) |
| 94 return false; | 103 return false; |
| 95 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 104 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
| 96 | 105 |
| 97 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) | 106 if (object->InternalFieldCount() < v8DefaultWrapperInternalFieldCount) |
| 98 return false; | 107 return false; |
| 99 | 108 |
| 100 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); | 109 const ScriptWrappable* untrustedScriptWrappable = toScriptWrappable(object); |
| 101 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); | 110 const WrapperTypeInfo* untrustedWrapperTypeInfo = toWrapperTypeInfo(object); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 isolate->GetCurrentContext()->Global(), | 158 isolate->GetCurrentContext()->Global(), |
| 150 isolate); | 159 isolate); |
| 151 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); | 160 LocalDOMWindow* callingWindow = currentDOMWindow(isolate); |
| 152 DOMWindow* targetWindow = toDOMWindow(m_context); | 161 DOMWindow* targetWindow = toDOMWindow(m_context); |
| 153 exceptionState.throwSecurityError( | 162 exceptionState.throwSecurityError( |
| 154 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), | 163 targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), |
| 155 targetWindow->crossDomainAccessErrorMessage(callingWindow)); | 164 targetWindow->crossDomainAccessErrorMessage(callingWindow)); |
| 156 } | 165 } |
| 157 | 166 |
| 158 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |