Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: webkit/port/bindings/v8/v8_proxy.cpp

Issue 113823: Added support for constructor calls in the NPAPI (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/port/bindings/v8/v8_proxy.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // 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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 result = function->Call(receiver, argc, args); 1150 result = function->Call(receiver, argc, args);
1151 } 1151 }
1152 1152
1153 if (v8::V8::IsDead()) 1153 if (v8::V8::IsDead())
1154 HandleFatalErrorInV8(); 1154 HandleFatalErrorInV8();
1155 1155
1156 return result; 1156 return result;
1157 } 1157 }
1158 1158
1159 1159
1160 v8::Local<v8::Value> V8Proxy::NewInstance(v8::Handle<v8::Function> constructor,
1161 int argc,
1162 v8::Handle<v8::Value> args[])
1163 {
1164 // No artificial limitations on the depth of recursion, see comment in
1165 // V8Proxy::CallFunction.
1166 v8::Local<v8::Value> result;
1167 {
1168 ConsoleMessageScope scope;
1169
1170 // See comment in V8Proxy::CallFunction.
1171 m_frame->keepAlive();
1172
1173 result = constructor->NewInstance(argc, args);
1174 }
1175
1176 if (v8::V8::IsDead())
1177 HandleFatalErrorInV8();
1178
1179 return result;
1180 }
1181
1182
1160 v8::Local<v8::Function> V8Proxy::GetConstructor(V8ClassIndex::V8WrapperType t){ 1183 v8::Local<v8::Function> V8Proxy::GetConstructor(V8ClassIndex::V8WrapperType t){
1161 // A DOM constructor is a function instance created from a DOM constructor 1184 // A DOM constructor is a function instance created from a DOM constructor
1162 // template. There is one instance per context. A DOM constructor is 1185 // template. There is one instance per context. A DOM constructor is
1163 // different from a normal function in two ways: 1186 // different from a normal function in two ways:
1164 // 1) it cannot be called as constructor (aka, used to create a DOM object) 1187 // 1) it cannot be called as constructor (aka, used to create a DOM object)
1165 // 2) its __proto__ points to Object.prototype rather than 1188 // 2) its __proto__ points to Object.prototype rather than
1166 // Function.prototype. 1189 // Function.prototype.
1167 // The reason for 2) is that, in Safari, a DOM constructor is a normal JS 1190 // The reason for 2) is that, in Safari, a DOM constructor is a normal JS
1168 // object, but not a function. Hotmail relies on the fact that, in Safari, 1191 // object, but not a function. Hotmail relies on the fact that, in Safari,
1169 // HTMLElement.__proto__ == Object.prototype. 1192 // HTMLElement.__proto__ == Object.prototype.
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 } 3359 }
3337 3360
3338 void V8Proxy::RegisterExtension(v8::Extension* extension, 3361 void V8Proxy::RegisterExtension(v8::Extension* extension,
3339 const String& schemeRestriction) { 3362 const String& schemeRestriction) {
3340 v8::RegisterExtension(extension); 3363 v8::RegisterExtension(extension);
3341 V8ExtensionInfo info = {schemeRestriction, extension}; 3364 V8ExtensionInfo info = {schemeRestriction, extension};
3342 m_extensions.push_back(info); 3365 m_extensions.push_back(info);
3343 } 3366 }
3344 3367
3345 } // namespace WebCore 3368 } // namespace WebCore
OLDNEW
« no previous file with comments | « webkit/port/bindings/v8/v8_proxy.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698