Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 imp->frame()->loader()->setOpener(0); | 225 imp->frame()->loader()->setOpener(0); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // Delete the accessor from this object. | 228 // Delete the accessor from this object. |
| 229 info.Holder()->Delete(name); | 229 info.Holder()->Delete(name); |
| 230 | 230 |
| 231 // Put property on the front (this) object. | 231 // Put property on the front (this) object. |
| 232 info.This()->Set(name, value); | 232 info.This()->Set(name, value); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void V8Window::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::V alue>& args) | |
| 236 { | |
| 237 String eventType = toWebCoreString(args[0]); | |
| 238 bool useCapture = args[2]->BooleanValue(); | |
| 239 | |
| 240 DOMWindow* imp = V8Window::toNative(args.Holder()); | |
| 241 | |
| 242 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame())) | |
| 243 return; | |
| 244 | |
| 245 Document* doc = imp->document(); | |
| 246 | |
| 247 if (!doc) | |
| 248 return; | |
| 249 | |
| 250 // FIXME: Check if there is not enough arguments | |
| 251 if (!imp->frame()) | |
|
haraken
2013/07/10 13:07:57
Looks like this check was not needed. We never hit
do-not-use
2013/07/10 13:16:52
Correct, BindingSecurity::shouldAllowAccessToFrame
| |
| 252 return; | |
| 253 | |
| 254 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[ 1], false, ListenerFindOrCreate); | |
| 255 | |
| 256 if (listener) { | |
| 257 imp->addEventListener(eventType, listener, useCapture); | |
| 258 createHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex, args.GetIsolate()); | |
| 259 } | |
| 260 } | |
| 261 | |
| 262 | |
| 263 void V8Window::removeEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& args) | |
| 264 { | |
| 265 String eventType = toWebCoreString(args[0]); | |
| 266 bool useCapture = args[2]->BooleanValue(); | |
| 267 | |
| 268 DOMWindow* imp = V8Window::toNative(args.Holder()); | |
| 269 | |
| 270 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame())) | |
| 271 return; | |
| 272 | |
| 273 Document* doc = imp->document(); | |
| 274 | |
| 275 if (!doc) | |
| 276 return; | |
| 277 | |
| 278 if (!imp->frame()) | |
|
haraken
2013/07/10 13:07:57
Ditto.
| |
| 279 return; | |
| 280 | |
| 281 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[ 1], false, ListenerFindOnly); | |
| 282 | |
| 283 if (listener) { | |
| 284 imp->removeEventListener(eventType, listener.get(), useCapture); | |
| 285 removeHiddenDependency(args.Holder(), args[1], eventListenerCacheIndex, args.GetIsolate()); | |
| 286 } | |
| 287 } | |
| 288 | |
| 289 static bool isLegacyTargetOriginDesignation(v8::Handle<v8::Value> value) | 235 static bool isLegacyTargetOriginDesignation(v8::Handle<v8::Value> value) |
| 290 { | 236 { |
| 291 if (value->IsString() || value->IsStringObject()) | 237 if (value->IsString() || value->IsStringObject()) |
| 292 return true; | 238 return true; |
| 293 return false; | 239 return false; |
| 294 } | 240 } |
| 295 | 241 |
| 296 | 242 |
| 297 void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & args) | 243 void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & args) |
| 298 { | 244 { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 ASSERT(!global.IsEmpty()); | 535 ASSERT(!global.IsEmpty()); |
| 590 return global; | 536 return global; |
| 591 } | 537 } |
| 592 | 538 |
| 593 v8::Handle<v8::Value> toV8ForMainWorld(DOMWindow* window, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 539 v8::Handle<v8::Value> toV8ForMainWorld(DOMWindow* window, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 594 { | 540 { |
| 595 return toV8(window, creationContext, isolate); | 541 return toV8(window, creationContext, isolate); |
| 596 } | 542 } |
| 597 | 543 |
| 598 } // namespace WebCore | 544 } // namespace WebCore |
| OLD | NEW |