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

« back to all changes in this revision

Viewing changes to JavaScriptCore/API/JSObjectRef.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:
105
105
    exec->globalData().heap.registerThread();
106
106
    JSLock lock(exec);
107
107
 
108
 
    JSValuePtr jsPrototype = jsClass 
 
108
    JSValue jsPrototype = jsClass 
109
109
        ? jsClass->prototype(exec)
110
110
        : exec->lexicalGlobalObject()->objectPrototype();
111
111
    
122
122
 
123
123
    Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
124
124
    
125
 
    ArgList args;
 
125
    MarkedArgumentBuffer args;
126
126
    for (unsigned i = 0; i < parameterCount; i++)
127
127
        args.append(jsString(exec, parameterNames[i]->ustring()));
128
128
    args.append(jsString(exec, body->ustring()));
130
130
    JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber);
131
131
    if (exec->hadException()) {
132
132
        if (exception)
133
 
            *exception = toRef(exec->exception());
 
133
            *exception = toRef(exec, exec->exception());
134
134
        exec->clearException();
135
135
        result = 0;
136
136
    }
145
145
 
146
146
    JSObject* result;
147
147
    if (argumentCount) {
148
 
        ArgList argList;
 
148
        MarkedArgumentBuffer argList;
149
149
        for (size_t i = 0; i < argumentCount; ++i)
150
 
            argList.append(toJS(arguments[i]));
 
150
            argList.append(toJS(exec, arguments[i]));
151
151
 
152
152
        result = constructArray(exec, argList);
153
153
    } else
155
155
 
156
156
    if (exec->hadException()) {
157
157
        if (exception)
158
 
            *exception = toRef(exec->exception());
 
158
            *exception = toRef(exec, exec->exception());
159
159
        exec->clearException();
160
160
        result = 0;
161
161
    }
169
169
    exec->globalData().heap.registerThread();
170
170
    JSLock lock(exec);
171
171
 
172
 
    ArgList argList;
 
172
    MarkedArgumentBuffer argList;
173
173
    for (size_t i = 0; i < argumentCount; ++i)
174
 
        argList.append(toJS(arguments[i]));
 
174
        argList.append(toJS(exec, arguments[i]));
175
175
 
176
176
    JSObject* result = constructDate(exec, argList);
177
177
    if (exec->hadException()) {
178
178
        if (exception)
179
 
            *exception = toRef(exec->exception());
 
179
            *exception = toRef(exec, exec->exception());
180
180
        exec->clearException();
181
181
        result = 0;
182
182
    }
190
190
    exec->globalData().heap.registerThread();
191
191
    JSLock lock(exec);
192
192
 
193
 
    ArgList argList;
 
193
    MarkedArgumentBuffer argList;
194
194
    for (size_t i = 0; i < argumentCount; ++i)
195
 
        argList.append(toJS(arguments[i]));
 
195
        argList.append(toJS(exec, arguments[i]));
196
196
 
197
197
    JSObject* result = constructError(exec, argList);
198
198
    if (exec->hadException()) {
199
199
        if (exception)
200
 
            *exception = toRef(exec->exception());
 
200
            *exception = toRef(exec, exec->exception());
201
201
        exec->clearException();
202
202
        result = 0;
203
203
    }
211
211
    exec->globalData().heap.registerThread();
212
212
    JSLock lock(exec);
213
213
 
214
 
    ArgList argList;
 
214
    MarkedArgumentBuffer argList;
215
215
    for (size_t i = 0; i < argumentCount; ++i)
216
 
        argList.append(toJS(arguments[i]));
 
216
        argList.append(toJS(exec, arguments[i]));
217
217
 
218
218
    JSObject* result = constructRegExp(exec, argList);
219
219
    if (exec->hadException()) {
220
220
        if (exception)
221
 
            *exception = toRef(exec->exception());
 
221
            *exception = toRef(exec, exec->exception());
222
222
        exec->clearException();
223
223
        result = 0;
224
224
    }
226
226
    return toRef(result);
227
227
}
228
228
 
229
 
JSValueRef JSObjectGetPrototype(JSContextRef, JSObjectRef object)
 
229
JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
230
230
{
 
231
    ExecState* exec = toJS(ctx);
 
232
    exec->globalData().heap.registerThread();
 
233
    JSLock lock(exec);
 
234
 
231
235
    JSObject* jsObject = toJS(object);
232
 
    return toRef(jsObject->prototype());
 
236
    return toRef(exec, jsObject->prototype());
233
237
}
234
238
 
235
 
void JSObjectSetPrototype(JSContextRef, JSObjectRef object, JSValueRef value)
 
239
void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
236
240
{
 
241
    ExecState* exec = toJS(ctx);
 
242
    exec->globalData().heap.registerThread();
 
243
    JSLock lock(exec);
 
244
 
237
245
    JSObject* jsObject = toJS(object);
238
 
    JSValuePtr jsValue = toJS(value);
 
246
    JSValue jsValue = toJS(exec, value);
239
247
 
240
248
    jsObject->setPrototype(jsValue.isObject() ? jsValue : jsNull());
241
249
}
259
267
 
260
268
    JSObject* jsObject = toJS(object);
261
269
 
262
 
    JSValuePtr jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));
 
270
    JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));
263
271
    if (exec->hadException()) {
264
272
        if (exception)
265
 
            *exception = toRef(exec->exception());
 
273
            *exception = toRef(exec, exec->exception());
266
274
        exec->clearException();
267
275
    }
268
 
    return toRef(jsValue);
 
276
    return toRef(exec, jsValue);
269
277
}
270
278
 
271
279
void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception)
276
284
 
277
285
    JSObject* jsObject = toJS(object);
278
286
    Identifier name(propertyName->identifier(&exec->globalData()));
279
 
    JSValuePtr jsValue = toJS(value);
 
287
    JSValue jsValue = toJS(exec, value);
280
288
 
281
289
    if (attributes && !jsObject->hasProperty(exec, name))
282
290
        jsObject->putWithAttributes(exec, name, jsValue, attributes);
287
295
 
288
296
    if (exec->hadException()) {
289
297
        if (exception)
290
 
            *exception = toRef(exec->exception());
 
298
            *exception = toRef(exec, exec->exception());
291
299
        exec->clearException();
292
300
    }
293
301
}
300
308
 
301
309
    JSObject* jsObject = toJS(object);
302
310
 
303
 
    JSValuePtr jsValue = jsObject->get(exec, propertyIndex);
 
311
    JSValue jsValue = jsObject->get(exec, propertyIndex);
304
312
    if (exec->hadException()) {
305
313
        if (exception)
306
 
            *exception = toRef(exec->exception());
 
314
            *exception = toRef(exec, exec->exception());
307
315
        exec->clearException();
308
316
    }
309
 
    return toRef(jsValue);
 
317
    return toRef(exec, jsValue);
310
318
}
311
319
 
312
320
 
317
325
    JSLock lock(exec);
318
326
 
319
327
    JSObject* jsObject = toJS(object);
320
 
    JSValuePtr jsValue = toJS(value);
 
328
    JSValue jsValue = toJS(exec, value);
321
329
    
322
330
    jsObject->put(exec, propertyIndex, jsValue);
323
331
    if (exec->hadException()) {
324
332
        if (exception)
325
 
            *exception = toRef(exec->exception());
 
333
            *exception = toRef(exec, exec->exception());
326
334
        exec->clearException();
327
335
    }
328
336
}
338
346
    bool result = jsObject->deleteProperty(exec, propertyName->identifier(&exec->globalData()));
339
347
    if (exec->hadException()) {
340
348
        if (exception)
341
 
            *exception = toRef(exec->exception());
 
349
            *exception = toRef(exec, exec->exception());
342
350
        exec->clearException();
343
351
    }
344
352
    return result;
389
397
    if (!jsThisObject)
390
398
        jsThisObject = exec->globalThisValue();
391
399
 
392
 
    ArgList argList;
 
400
    MarkedArgumentBuffer argList;
393
401
    for (size_t i = 0; i < argumentCount; i++)
394
 
        argList.append(toJS(arguments[i]));
 
402
        argList.append(toJS(exec, arguments[i]));
395
403
 
396
404
    CallData callData;
397
405
    CallType callType = jsObject->getCallData(callData);
398
406
    if (callType == CallTypeNone)
399
407
        return 0;
400
408
 
401
 
    JSValueRef result = toRef(call(exec, jsObject, callType, callData, jsThisObject, argList));
 
409
    JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList));
402
410
    if (exec->hadException()) {
403
411
        if (exception)
404
 
            *exception = toRef(exec->exception());
 
412
            *exception = toRef(exec, exec->exception());
405
413
        exec->clearException();
406
414
        result = 0;
407
415
    }
428
436
    if (constructType == ConstructTypeNone)
429
437
        return 0;
430
438
 
431
 
    ArgList argList;
 
439
    MarkedArgumentBuffer argList;
432
440
    for (size_t i = 0; i < argumentCount; i++)
433
 
        argList.append(toJS(arguments[i]));
 
441
        argList.append(toJS(exec, arguments[i]));
434
442
    JSObjectRef result = toRef(construct(exec, jsObject, constructType, constructData, argList));
435
443
    if (exec->hadException()) {
436
444
        if (exception)
437
 
            *exception = toRef(exec->exception());
 
445
            *exception = toRef(exec, exec->exception());
438
446
        exec->clearException();
439
447
        result = 0;
440
448
    }