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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // TODO(yukishiino): This code does not create a wrapper with | 65 // TODO(yukishiino): This code does not create a wrapper with |
66 // the correct settings. Should follow the same way as | 66 // the correct settings. Should follow the same way as |
67 // V8PerContextData::createWrapperFromCache, though there is no need to | 67 // V8PerContextData::createWrapperFromCache, though there is no need to |
68 // cache resulting objects or their constructors. | 68 // cache resulting objects or their constructors. |
69 const DOMWrapperWorld& world = DOMWrapperWorld::World(scope.GetContext()); | 69 const DOMWrapperWorld& world = DOMWrapperWorld::World(scope.GetContext()); |
70 wrapper = type->domTemplate(isolate, world) | 70 wrapper = type->domTemplate(isolate, world) |
71 ->InstanceTemplate() | 71 ->InstanceTemplate() |
72 ->NewInstance(scope.GetContext()) | 72 ->NewInstance(scope.GetContext()) |
73 .ToLocalChecked(); | 73 .ToLocalChecked(); |
74 } | 74 } |
| 75 DCHECK(!wrapper.IsEmpty()); |
75 return wrapper; | 76 return wrapper; |
76 } | 77 } |
77 | 78 |
78 bool V8DOMWrapper::IsWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value) { | 79 bool V8DOMWrapper::IsWrapper(v8::Isolate* isolate, v8::Local<v8::Value> value) { |
79 if (value.IsEmpty() || !value->IsObject()) | 80 if (value.IsEmpty() || !value->IsObject()) |
80 return false; | 81 return false; |
81 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 82 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
82 | 83 |
83 if (object->InternalFieldCount() < kV8DefaultWrapperInternalFieldCount) | 84 if (object->InternalFieldCount() < kV8DefaultWrapperInternalFieldCount) |
84 return false; | 85 return false; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ExceptionState exception_state(isolate, ExceptionState::kConstructionContext, | 151 ExceptionState exception_state(isolate, ExceptionState::kConstructionContext, |
151 "Location"); | 152 "Location"); |
152 LocalDOMWindow* calling_window = CurrentDOMWindow(isolate); | 153 LocalDOMWindow* calling_window = CurrentDOMWindow(isolate); |
153 LocalDOMWindow* target_window = ToLocalDOMWindow(context_); | 154 LocalDOMWindow* target_window = ToLocalDOMWindow(context_); |
154 exception_state.ThrowSecurityError( | 155 exception_state.ThrowSecurityError( |
155 target_window->SanitizedCrossDomainAccessErrorMessage(calling_window), | 156 target_window->SanitizedCrossDomainAccessErrorMessage(calling_window), |
156 target_window->CrossDomainAccessErrorMessage(calling_window)); | 157 target_window->CrossDomainAccessErrorMessage(calling_window)); |
157 } | 158 } |
158 | 159 |
159 } // namespace blink | 160 } // namespace blink |
OLD | NEW |