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

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

Issue 27400003: Get rid of custom code for Window.location attribute setter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Keep attribute Replaceable Created 7 years, 2 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
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/core/frame/Window.idl » ('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) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/inspector/ScriptCallStack.h" 52 #include "core/inspector/ScriptCallStack.h"
53 #include "core/loader/FrameLoadRequest.h" 53 #include "core/loader/FrameLoadRequest.h"
54 #include "core/loader/FrameLoader.h" 54 #include "core/loader/FrameLoader.h"
55 #include "core/page/Chrome.h" 55 #include "core/page/Chrome.h"
56 #include "core/frame/ContentSecurityPolicy.h" 56 #include "core/frame/ContentSecurityPolicy.h"
57 #include "core/frame/DOMTimer.h" 57 #include "core/frame/DOMTimer.h"
58 #include "core/frame/DOMWindow.h" 58 #include "core/frame/DOMWindow.h"
59 #include "core/frame/DOMWindowTimers.h" 59 #include "core/frame/DOMWindowTimers.h"
60 #include "core/frame/Frame.h" 60 #include "core/frame/Frame.h"
61 #include "core/frame/FrameView.h" 61 #include "core/frame/FrameView.h"
62 #include "core/frame/Location.h"
63 #include "core/page/Page.h" 62 #include "core/page/Page.h"
64 #include "core/page/Settings.h" 63 #include "core/page/Settings.h"
65 #include "core/page/WindowFeatures.h" 64 #include "core/page/WindowFeatures.h"
66 #include "core/platform/PlatformScreen.h" 65 #include "core/platform/PlatformScreen.h"
67 #include "core/platform/graphics/MediaPlayer.h" 66 #include "core/platform/graphics/MediaPlayer.h"
68 #include "core/storage/Storage.h" 67 #include "core/storage/Storage.h"
69 #include "core/workers/SharedWorkerRepository.h" 68 #include "core/workers/SharedWorkerRepository.h"
70 #include "wtf/ArrayBuffer.h" 69 #include "wtf/ArrayBuffer.h"
71 #include "wtf/OwnPtr.h" 70 #include "wtf/OwnPtr.h"
72 71
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 193
195 ASSERT(frame); 194 ASSERT(frame);
196 v8::Local<v8::Context> context = frame->script()->currentWorldContext(); 195 v8::Local<v8::Context> context = frame->script()->currentWorldContext();
197 if (context.IsEmpty()) 196 if (context.IsEmpty())
198 return; 197 return;
199 198
200 v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(info.GetIso late()); 199 v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(info.GetIso late());
201 context->Global()->SetHiddenValue(eventSymbol, value); 200 context->Global()->SetHiddenValue(eventSymbol, value);
202 } 201 }
203 202
204 void V8Window::locationAttributeSetterCustom(v8::Local<v8::String> name, v8::Loc al<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
205 {
206 DOMWindow* imp = V8Window::toNative(info.Holder());
207
208 if (Location* location = imp->location()) {
209 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, href, value);
210 location->setHref(activeDOMWindow(), firstDOMWindow(), href);
211 }
212 }
213
214 void V8Window::openerAttributeSetterCustom(v8::Local<v8::String> name, v8::Local <v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 203 void V8Window::openerAttributeSetterCustom(v8::Local<v8::String> name, v8::Local <v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
215 { 204 {
216 DOMWindow* imp = V8Window::toNative(info.Holder()); 205 DOMWindow* imp = V8Window::toNative(info.Holder());
217 ExceptionState es(info.GetIsolate()); 206 ExceptionState es(info.GetIsolate());
218 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) { 207 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) {
219 es.throwIfNeeded(); 208 es.throwIfNeeded();
220 return; 209 return;
221 } 210 }
222 211
223 // Opener can be shadowed if it is in the same domain. 212 // Opener can be shadowed if it is in the same domain.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); 538 v8::Handle<v8::Context> context = frame->script()->currentWorldContext();
550 if (context.IsEmpty()) 539 if (context.IsEmpty())
551 return v8Undefined(); 540 return v8Undefined();
552 541
553 v8::Handle<v8::Object> global = context->Global(); 542 v8::Handle<v8::Object> global = context->Global();
554 ASSERT(!global.IsEmpty()); 543 ASSERT(!global.IsEmpty());
555 return global; 544 return global;
556 } 545 }
557 546
558 } // namespace WebCore 547 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/core/frame/Window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698