| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // We return 0 here because |context| is detached from the Frame. If we | 789 // We return 0 here because |context| is detached from the Frame. If we |
| 790 // did return |frame| we could get in trouble because the frame could be | 790 // did return |frame| we could get in trouble because the frame could be |
| 791 // navigated to another security origin. | 791 // navigated to another security origin. |
| 792 return nullptr; | 792 return nullptr; |
| 793 } | 793 } |
| 794 | 794 |
| 795 EventTarget* toEventTarget(v8::Isolate* isolate, v8::Local<v8::Value> value) { | 795 EventTarget* toEventTarget(v8::Isolate* isolate, v8::Local<v8::Value> value) { |
| 796 // We need to handle a DOMWindow specially, because a DOMWindow wrapper | 796 // We need to handle a DOMWindow specially, because a DOMWindow wrapper |
| 797 // exists on a prototype chain of v8Value. | 797 // exists on a prototype chain of v8Value. |
| 798 if (DOMWindow* window = toDOMWindow(isolate, value)) | 798 if (DOMWindow* window = toDOMWindow(isolate, value)) |
| 799 return static_cast<EventTarget*>(window); | 799 return window; |
| 800 if (V8EventTarget::hasInstance(value, isolate)) { | 800 if (V8EventTarget::hasInstance(value, isolate)) { |
| 801 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 801 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
| 802 return toWrapperTypeInfo(object)->toEventTarget(object); | 802 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); |
| 803 if (wrapperTypeInfo->eventTargetInheritance == |
| 804 WrapperTypeInfo::NotInheritFromEventTarget) |
| 805 return nullptr; |
| 806 return static_cast<EventTarget*>(toScriptWrappable(object)); |
| 803 } | 807 } |
| 804 return 0; | 808 return nullptr; |
| 805 } | 809 } |
| 806 | 810 |
| 807 void toFlexibleArrayBufferView(v8::Isolate* isolate, | 811 void toFlexibleArrayBufferView(v8::Isolate* isolate, |
| 808 v8::Local<v8::Value> value, | 812 v8::Local<v8::Value> value, |
| 809 FlexibleArrayBufferView& result, | 813 FlexibleArrayBufferView& result, |
| 810 void* storage) { | 814 void* storage) { |
| 811 ASSERT(value->IsArrayBufferView()); | 815 ASSERT(value->IsArrayBufferView()); |
| 812 v8::Local<v8::ArrayBufferView> buffer = value.As<v8::ArrayBufferView>(); | 816 v8::Local<v8::ArrayBufferView> buffer = value.As<v8::ArrayBufferView>(); |
| 813 if (!storage) { | 817 if (!storage) { |
| 814 result.setFull(V8ArrayBufferView::toImpl(buffer)); | 818 result.setFull(V8ArrayBufferView::toImpl(buffer)); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 1017 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
| 1014 parsed, tryCatch)) { | 1018 parsed, tryCatch)) { |
| 1015 if (tryCatch.HasCaught()) | 1019 if (tryCatch.HasCaught()) |
| 1016 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 1020 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1019 return parsed; | 1023 return parsed; |
| 1020 } | 1024 } |
| 1021 | 1025 |
| 1022 } // namespace blink | 1026 } // namespace blink |
| OLD | NEW |