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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 1938943002: Use v8::Object::CreateDataProperty() for object construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return; 414 return;
415 415
416 ScriptState* scriptState = isolatedWorldWindowProxy->getScriptState(); 416 ScriptState* scriptState = isolatedWorldWindowProxy->getScriptState();
417 v8::Context::Scope scope(scriptState->context()); 417 v8::Context::Scope scope(scriptState->context());
418 v8::Local<v8::Array> resultArray = v8::Array::New(isolate(), sources.size()) ; 418 v8::Local<v8::Array> resultArray = v8::Array::New(isolate(), sources.size()) ;
419 419
420 for (size_t i = 0; i < sources.size(); ++i) { 420 for (size_t i = 0; i < sources.size(); ++i) {
421 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri ptState->context(), sources[i]); 421 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri ptState->context(), sources[i]);
422 if (evaluationResult.IsEmpty()) 422 if (evaluationResult.IsEmpty())
423 evaluationResult = v8::Local<v8::Value>::New(isolate(), v8::Undefine d(isolate())); 423 evaluationResult = v8::Local<v8::Value>::New(isolate(), v8::Undefine d(isolate()));
424 if (!v8CallBoolean(resultArray->Set(scriptState->context(), v8::Integer: :New(scriptState->isolate(), i), evaluationResult))) 424 if (!v8CallBoolean(resultArray->CreateDataProperty(scriptState->context( ), i, evaluationResult)))
425 return; 425 return;
426 } 426 }
427 427
428 if (results) { 428 if (results) {
429 for (size_t i = 0; i < resultArray->Length(); ++i) { 429 for (size_t i = 0; i < resultArray->Length(); ++i) {
430 v8::Local<v8::Value> value; 430 v8::Local<v8::Value> value;
431 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 431 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
432 return; 432 return;
433 results->append(value); 433 results->append(value);
434 } 434 }
435 } 435 }
436 } 436 }
437 437
438 } // namespace blink 438 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptPromise.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698