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

Side by Side Diff: Source/bindings/v8/custom/V8WindowCustom.cpp

Issue 23526039: Replace several uses of toWebCoreString() by V8TRYCATCH_FOR_V8STRINGRESOURCE() macro (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 DOMWindow* imp = V8Window::toNative(info.Holder()); 206 DOMWindow* imp = V8Window::toNative(info.Holder());
207 207
208 DOMWindow* active = activeDOMWindow(); 208 DOMWindow* active = activeDOMWindow();
209 if (!active) 209 if (!active)
210 return; 210 return;
211 211
212 DOMWindow* first = firstDOMWindow(); 212 DOMWindow* first = firstDOMWindow();
213 if (!first) 213 if (!first)
214 return; 214 return;
215 215
216 if (Location* location = imp->location()) 216 if (Location* location = imp->location()) {
217 location->setHref(active, first, toWebCoreString(value)); 217 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, href, value);
218 location->setHref(active, first, href);
219 }
218 } 220 }
219 221
220 void V8Window::openerAttributeSetterCustom(v8::Local<v8::String> name, v8::Local <v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 222 void V8Window::openerAttributeSetterCustom(v8::Local<v8::String> name, v8::Local <v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
221 { 223 {
222 DOMWindow* imp = V8Window::toNative(info.Holder()); 224 DOMWindow* imp = V8Window::toNative(info.Holder());
223 ExceptionState es(info.GetIsolate()); 225 ExceptionState es(info.GetIsolate());
224 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) { 226 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) {
225 es.throwIfNeeded(); 227 es.throwIfNeeded();
226 return; 228 return;
227 } 229 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 { 376 {
375 DOMWindow* impl = V8Window::toNative(args.Holder()); 377 DOMWindow* impl = V8Window::toNative(args.Holder());
376 ExceptionState es(args.GetIsolate()); 378 ExceptionState es(args.GetIsolate());
377 if (!BindingSecurity::shouldAllowAccessToFrame(impl->frame(), es)) { 379 if (!BindingSecurity::shouldAllowAccessToFrame(impl->frame(), es)) {
378 es.throwIfNeeded(); 380 es.throwIfNeeded();
379 return; 381 return;
380 } 382 }
381 383
382 // FIXME: Handle exceptions properly. 384 // FIXME: Handle exceptions properly.
383 String urlString = toWebCoreStringWithUndefinedOrNullCheck(args[0]); 385 String urlString = toWebCoreStringWithUndefinedOrNullCheck(args[0]);
384 AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_b lank" : AtomicString(toWebCoreString(args[1])); 386 AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_b lank" : toWebCoreAtomicString(args[1]);
385 String windowFeaturesString = toWebCoreStringWithUndefinedOrNullCheck(args[2 ]); 387 String windowFeaturesString = toWebCoreStringWithUndefinedOrNullCheck(args[2 ]);
386 388
387 RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeat uresString, activeDOMWindow(), firstDOMWindow()); 389 RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeat uresString, activeDOMWindow(), firstDOMWindow());
388 if (!openedWindow) 390 if (!openedWindow)
389 return; 391 return;
390 392
391 v8SetReturnValueFast(args, openedWindow.release(), impl); 393 v8SetReturnValueFast(args, openedWindow.release(), impl);
392 } 394 }
393 395
394 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Value>& info) 396 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Value>& info)
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); 557 v8::Handle<v8::Context> context = frame->script()->currentWorldContext();
556 if (context.IsEmpty()) 558 if (context.IsEmpty())
557 return v8Undefined(); 559 return v8Undefined();
558 560
559 v8::Handle<v8::Object> global = context->Global(); 561 v8::Handle<v8::Object> global = context->Global();
560 ASSERT(!global.IsEmpty()); 562 ASSERT(!global.IsEmpty());
561 return global; 563 return global;
562 } 564 }
563 565
564 } // namespace WebCore 566 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698