| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "bindings/core/v8/V8HTMLDocument.h" | 32 #include "bindings/core/v8/V8HTMLDocument.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
| 35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
| 36 #include "bindings/core/v8/V8HTMLAllCollection.h" | 36 #include "bindings/core/v8/V8HTMLAllCollection.h" |
| 37 #include "bindings/core/v8/V8HTMLCollection.h" | 37 #include "bindings/core/v8/V8HTMLCollection.h" |
| 38 #include "bindings/core/v8/V8Node.h" | 38 #include "bindings/core/v8/V8Node.h" |
| 39 #include "bindings/core/v8/V8Window.h" | 39 #include "bindings/core/v8/V8Window.h" |
| 40 #include "core/HTMLNames.h" | 40 #include "core/HTMLNames.h" |
| 41 #include "core/frame/FrameProtector.h" |
| 41 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 42 #include "core/html/HTMLAllCollection.h" | 43 #include "core/html/HTMLAllCollection.h" |
| 43 #include "core/html/HTMLCollection.h" | 44 #include "core/html/HTMLCollection.h" |
| 44 #include "core/html/HTMLDocument.h" | 45 #include "core/html/HTMLDocument.h" |
| 45 #include "core/html/HTMLIFrameElement.h" | 46 #include "core/html/HTMLIFrameElement.h" |
| 46 #include "wtf/OwnPtr.h" | 47 #include "wtf/OwnPtr.h" |
| 47 #include "wtf/RefPtr.h" | 48 #include "wtf/RefPtr.h" |
| 48 #include "wtf/StdLibExtras.h" | 49 #include "wtf/StdLibExtras.h" |
| 49 | 50 |
| 50 namespace blink { | 51 namespace blink { |
| 51 | 52 |
| 52 // HTMLDocument ---------------------------------------------------------------- | 53 // HTMLDocument ---------------------------------------------------------------- |
| 53 | 54 |
| 54 void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 55 void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 55 { | 56 { |
| 56 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); | 57 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); |
| 57 | 58 |
| 58 if (info.Length() > 2) { | 59 if (info.Length() > 2) { |
| 59 if (RefPtr<LocalFrame> frame = htmlDocument->frame()) { | 60 if (LocalFrame* frame = htmlDocument->frame()) { |
| 61 FrameProtector protect(frame); |
| 60 // Fetch the global object for the frame. | 62 // Fetch the global object for the frame. |
| 61 v8::Local<v8::Context> context = toV8Context(frame.get(), DOMWrapper
World::current(info.GetIsolate())); | 63 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld:
:current(info.GetIsolate())); |
| 62 // Bail out if we cannot get the context. | 64 // Bail out if we cannot get the context. |
| 63 if (context.IsEmpty()) | 65 if (context.IsEmpty()) |
| 64 return; | 66 return; |
| 65 v8::Local<v8::Object> global = context->Global(); | 67 v8::Local<v8::Object> global = context->Global(); |
| 66 // Get the open property of the global object. | 68 // Get the open property of the global object. |
| 67 v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetI
solate(), "open")); | 69 v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetI
solate(), "open")); |
| 68 // Failed; return without throwing (new) exception. | 70 // Failed; return without throwing (new) exception. |
| 69 if (function.IsEmpty()) | 71 if (function.IsEmpty()) |
| 70 return; | 72 return; |
| 71 // If the open property is not a function throw a type error. | 73 // If the open property is not a function throw a type error. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 85 | 87 |
| 86 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Doc
ument", info.Holder(), info.GetIsolate()); | 88 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Doc
ument", info.Holder(), info.GetIsolate()); |
| 87 htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptio
nState); | 89 htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptio
nState); |
| 88 if (exceptionState.throwIfNeeded()) | 90 if (exceptionState.throwIfNeeded()) |
| 89 return; | 91 return; |
| 90 | 92 |
| 91 v8SetReturnValue(info, info.Holder()); | 93 v8SetReturnValue(info, info.Holder()); |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |