| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (info.Length() > 2) { | 58 if (info.Length() > 2) { |
| 59 if (RefPtr<LocalFrame> frame = htmlDocument->frame()) { | 59 if (RefPtr<LocalFrame> frame = htmlDocument->frame()) { |
| 60 // Fetch the global object for the frame. | 60 // Fetch the global object for the frame. |
| 61 v8::Local<v8::Context> context = toV8Context(info.GetIsolate(), fram
e.get(), DOMWrapperWorld::current(info.GetIsolate())); | 61 v8::Local<v8::Context> context = toV8Context(info.GetIsolate(), fram
e.get(), DOMWrapperWorld::current(info.GetIsolate())); |
| 62 // Bail out if we cannot get the context. | 62 // Bail out if we cannot get the context. |
| 63 if (context.IsEmpty()) | 63 if (context.IsEmpty()) |
| 64 return; | 64 return; |
| 65 v8::Local<v8::Object> global = context->Global(); | 65 v8::Local<v8::Object> global = context->Global(); |
| 66 // Get the open property of the global object. | 66 // Get the open property of the global object. |
| 67 v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetI
solate(), "open")); | 67 v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetI
solate(), "open")); |
| 68 // Failed; return without throwing (new) exception. |
| 69 if (function.IsEmpty()) |
| 70 return; |
| 68 // If the open property is not a function throw a type error. | 71 // If the open property is not a function throw a type error. |
| 69 if (!function->IsFunction()) { | 72 if (!function->IsFunction()) { |
| 70 throwTypeError("open is not a function", info.GetIsolate()); | 73 throwTypeError("open is not a function", info.GetIsolate()); |
| 71 return; | 74 return; |
| 72 } | 75 } |
| 73 // Wrap up the arguments and call the function. | 76 // Wrap up the arguments and call the function. |
| 74 OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<
v8::Value>[info.Length()]); | 77 OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<
v8::Value>[info.Length()]); |
| 75 for (int i = 0; i < info.Length(); i++) | 78 for (int i = 0; i < info.Length(); i++) |
| 76 params[i] = info[i]; | 79 params[i] = info[i]; |
| 77 | 80 |
| 78 v8SetReturnValue(info, frame->script().callFunction(v8::Local<v8::Fu
nction>::Cast(function), global, info.Length(), params.get())); | 81 v8SetReturnValue(info, frame->script().callFunction(v8::Local<v8::Fu
nction>::Cast(function), global, info.Length(), params.get())); |
| 79 return; | 82 return; |
| 80 } | 83 } |
| 81 } | 84 } |
| 82 | 85 |
| 83 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Doc
ument", info.Holder(), info.GetIsolate()); | 86 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Doc
ument", info.Holder(), info.GetIsolate()); |
| 84 htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptio
nState); | 87 htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptio
nState); |
| 85 if (exceptionState.throwIfNeeded()) | 88 if (exceptionState.throwIfNeeded()) |
| 86 return; | 89 return; |
| 87 | 90 |
| 88 v8SetReturnValue(info, info.Holder()); | 91 v8SetReturnValue(info, info.Holder()); |
| 89 } | 92 } |
| 90 | 93 |
| 91 } // namespace WebCore | 94 } // namespace WebCore |
| OLD | NEW |