jscript: Don't allow construction on builtin methods.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
79e51d6bc5
commit
738e306bf7
2 changed files with 3 additions and 0 deletions
|
@ -619,6 +619,8 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, js
|
|||
{
|
||||
NativeFunction *function = (NativeFunction*)func;
|
||||
|
||||
if((flags & DISPATCH_CONSTRUCT) && !(function->function.flags & PROPF_CONSTR))
|
||||
return JS_E_INVALID_ACTION;
|
||||
return function->proc(ctx, vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r);
|
||||
}
|
||||
|
||||
|
|
|
@ -2622,6 +2622,7 @@ testException(function() {"test" in nullDisp;}, "E_OBJECT_EXPECTED");
|
|||
testException(function() {new 3;}, "E_UNSUPPORTED_ACTION");
|
||||
testException(function() {new null;}, "E_OBJECT_EXPECTED");
|
||||
testException(function() {new nullDisp;}, "E_NO_PROPERTY");
|
||||
testException(function() {new Math.max(5);}, "E_UNSUPPORTED_ACTION");
|
||||
testException(function() {new VBArray();}, "E_NOT_VBARRAY");
|
||||
testException(function() {new VBArray(new VBArray(createArray()));}, "E_NOT_VBARRAY");
|
||||
testException(function() {VBArray.prototype.lbound.call(new Object());}, "E_NOT_VBARRAY");
|
||||
|
|
Loading…
Add table
Reference in a new issue