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

Issue 100243: Redo patch http://codereview.chromium.org/60035 (Closed)

Created:
11 years, 7 months ago by Feng Qian
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

A simple fix of issue http://code.google.com/p/chromium/issues/detail?id=3285 NPN_Construct allows a NPObject to be called as a construct. For example, the test case var s = new app.Packages.java.lang.Integer(5); app.Packages.java.lang.Integer is a NPObject, and it implements NPN_Construct. This fix allows a JSObject created by an API function be called as a construct if it can be called as a function. This is done by generating the same code for var s = new app.Packages.java.lang.Integer(5); as var s = app.Packages.java.lang.Integer(5); and the caller handles both case correctly. A more sophiscated fix is to one extra JSConstructCall frame and allow CallAsConstructor in Builtin::HandleApiCallAsFunction. This change itself shouldn't affect the semantic of normal case such as: var a = {}; var s = new a(); A TypeError exception will be thrown in CALL_NON_FUNCTION (runtime.js). Another part of fix is in the binding code, V8NPObject, which makes NPN_InvokeDefault or NPN_Construct call depending on which function is available. Committed: http://code.google.com/p/v8/source/detail?r=1837

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -11 lines) Patch
M src/ia32/builtins-ia32.cc View 3 chunks +18 lines, -6 lines 0 comments Download
M test/cctest/test-api.cc View 1 chunk +0 lines, -5 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Feng Qian
Hi Mads, This is the same patch as http://codereview.chromium.org/60035 I lost the old client, and ...
11 years, 7 months ago (2009-05-01 03:19:27 UTC) #1
Mads Ager (chromium)
11 years, 7 months ago (2009-05-01 05:36:39 UTC) #2
LGTM with the comments from http://codereview.chromium.org/60035.

Powered by Google App Engine
This is Rietveld 408576698