~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to JavaScriptCore/runtime/ArrayConstructor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include "ArrayPrototype.h"
28
28
#include "JSArray.h"
 
29
#include "JSFunction.h"
29
30
#include "Lookup.h"
30
31
 
31
32
namespace JSC {
45
46
static JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args)
46
47
{
47
48
    // a single numeric argument denotes the array size (!)
48
 
    if (args.size() == 1 && args.at(exec, 0).isNumber()) {
49
 
        uint32_t n = args.at(exec, 0).toUInt32(exec);
50
 
        if (n != args.at(exec, 0).toNumber(exec))
 
49
    if (args.size() == 1 && args.at(0).isNumber()) {
 
50
        uint32_t n = args.at(0).toUInt32(exec);
 
51
        if (n != args.at(0).toNumber(exec))
51
52
            return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
52
53
        return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), n);
53
54
    }
54
55
 
55
56
    // otherwise the array is constructed with the arguments in it
56
 
    return new (exec) JSArray(exec, exec->lexicalGlobalObject()->arrayStructure(), args);
 
57
    return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), args);
57
58
}
58
59
 
59
60
static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args)
68
69
    return ConstructTypeHost;
69
70
}
70
71
 
71
 
static JSValuePtr callArrayConstructor(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)
 
72
static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
72
73
{
73
74
    return constructArrayWithSizeQuirk(exec, args);
74
75
}