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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 1153613007: bindings: Use CreateDataProperty() instead of ForceSet() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 558
559 host->client()->unmuteWarningsAndDeprecations(); 559 host->client()->unmuteWarningsAndDeprecations();
560 } 560 }
561 561
562 void V8InjectedScriptHost::setNonEnumPropertyMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info) 562 void V8InjectedScriptHost::setNonEnumPropertyMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
563 { 563 {
564 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString()) 564 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString())
565 return; 565 return;
566 566
567 v8::Local<v8::Object> object = info[0].As<v8::Object>(); 567 v8::Local<v8::Object> object = info[0].As<v8::Object>();
568 object->ForceSet(info.GetIsolate()->GetCurrentContext(), info[1], info[2], v 8::DontEnum); 568 v8::Local<v8::String> key = info[1].As<v8::String>();
569 auto unused = object->DefineOwnProperty(info.GetIsolate()->GetCurrentContext (), key, info[2], v8::DontEnum);
bashi 2015/06/03 03:05:30 This causes an exception.
570 ALLOW_UNUSED_LOCAL(unused);
569 } 571 }
570 572
571 void V8InjectedScriptHost::bindMethodCustom(const v8::FunctionCallbackInfo<v8::V alue>& info) 573 void V8InjectedScriptHost::bindMethodCustom(const v8::FunctionCallbackInfo<v8::V alue>& info)
572 { 574 {
573 if (info.Length() < 2 || !info[1]->IsString()) 575 if (info.Length() < 2 || !info[1]->IsString())
574 return; 576 return;
575 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 577 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
576 if (!injectedScriptNative) 578 if (!injectedScriptNative)
577 return; 579 return;
578 580
(...skipping 23 matching lines...) Expand all
602 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 604 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
603 if (!injectedScriptNative) 605 if (!injectedScriptNative)
604 return; 606 return;
605 int id = info[0].As<v8::Int32>()->Value(); 607 int id = info[0].As<v8::Int32>()->Value();
606 String groupName = injectedScriptNative->groupName(id); 608 String groupName = injectedScriptNative->groupName(id);
607 if (!groupName.isEmpty()) 609 if (!groupName.isEmpty())
608 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); 610 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName));
609 } 611 }
610 612
611 } // namespace blink 613 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698