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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 htmlDocument->writeln(writeHelperGetString(args), activeDOMWindow()->documen
t()); | 78 htmlDocument->writeln(writeHelperGetString(args), activeDOMWindow()->documen
t()); |
79 } | 79 } |
80 | 80 |
81 void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | 81 void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) |
82 { | 82 { |
83 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder()); | 83 HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder()); |
84 | 84 |
85 if (args.Length() > 2) { | 85 if (args.Length() > 2) { |
86 if (RefPtr<Frame> frame = htmlDocument->frame()) { | 86 if (RefPtr<Frame> frame = htmlDocument->frame()) { |
87 // Fetch the global object for the frame. | 87 // Fetch the global object for the frame. |
88 v8::Local<v8::Context> context = frame->script()->currentWorldContex
t(); | 88 v8::Local<v8::Context> context = frame->script().currentWorldContext
(); |
89 // Bail out if we cannot get the context. | 89 // Bail out if we cannot get the context. |
90 if (context.IsEmpty()) | 90 if (context.IsEmpty()) |
91 return; | 91 return; |
92 v8::Local<v8::Object> global = context->Global(); | 92 v8::Local<v8::Object> global = context->Global(); |
93 // Get the open property of the global object. | 93 // Get the open property of the global object. |
94 v8::Local<v8::Value> function = global->Get(v8::String::NewSymbol("o
pen")); | 94 v8::Local<v8::Value> function = global->Get(v8::String::NewSymbol("o
pen")); |
95 // If the open property is not a function throw a type error. | 95 // If the open property is not a function throw a type error. |
96 if (!function->IsFunction()) { | 96 if (!function->IsFunction()) { |
97 throwTypeError("open is not a function", args.GetIsolate()); | 97 throwTypeError("open is not a function", args.GetIsolate()); |
98 return; | 98 return; |
99 } | 99 } |
100 // Wrap up the arguments and call the function. | 100 // Wrap up the arguments and call the function. |
101 OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<
v8::Value>[args.Length()]); | 101 OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<
v8::Value>[args.Length()]); |
102 for (int i = 0; i < args.Length(); i++) | 102 for (int i = 0; i < args.Length(); i++) |
103 params[i] = args[i]; | 103 params[i] = args[i]; |
104 | 104 |
105 v8SetReturnValue(args, frame->script()->callFunction(v8::Local<v8::F
unction>::Cast(function), global, args.Length(), params.get())); | 105 v8SetReturnValue(args, frame->script().callFunction(v8::Local<v8::Fu
nction>::Cast(function), global, args.Length(), params.get())); |
106 return; | 106 return; |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 htmlDocument->open(activeDOMWindow()->document()); | 110 htmlDocument->open(activeDOMWindow()->document()); |
111 v8SetReturnValue(args, args.Holder()); | 111 v8SetReturnValue(args, args.Holder()); |
112 } | 112 } |
113 | 113 |
114 } // namespace WebCore | 114 } // namespace WebCore |
OLD | NEW |