• feng@chromium.org's avatar
    A simple fix of issue http://code.google.com/p/chromium/issues/detail?id=3285 · ecd70581
    feng@chromium.org authored
    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. 
    Review URL: http://codereview.chromium.org/100243
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1837 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    ecd70581
Name
Last commit
Last update
..
SConscript Loading commit data...
cctest.cc Loading commit data...
cctest.h Loading commit data...
cctest.status Loading commit data...
test-alloc.cc Loading commit data...
test-api.cc Loading commit data...
test-assembler-arm.cc Loading commit data...
test-assembler-ia32.cc Loading commit data...
test-ast.cc Loading commit data...
test-compiler.cc Loading commit data...
test-conversions.cc Loading commit data...
test-debug.cc Loading commit data...
test-decls.cc Loading commit data...
test-disasm-arm.cc Loading commit data...
test-disasm-ia32.cc Loading commit data...
test-flags.cc Loading commit data...
test-func-name-inference.cc Loading commit data...
test-hashmap.cc Loading commit data...
test-heap.cc Loading commit data...
test-list.cc Loading commit data...
test-lock.cc Loading commit data...
test-log-ia32.cc Loading commit data...
test-mark-compact.cc Loading commit data...
test-platform-linux.cc Loading commit data...
test-platform-macos.cc Loading commit data...
test-platform-nullos.cc Loading commit data...
test-platform-win32.cc Loading commit data...
test-regexp.cc Loading commit data...
test-serialize.cc Loading commit data...
test-sockets.cc Loading commit data...
test-spaces.cc Loading commit data...
test-strings.cc Loading commit data...
test-threads.cc Loading commit data...
test-utils.cc Loading commit data...
test-version.cc Loading commit data...
testcfg.py Loading commit data...