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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 RefPtrWillBeRawPtr<DOMWindow> openedWindow = impl->open(urlString, frameName
, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(in
fo.GetIsolate())); | 247 RefPtrWillBeRawPtr<DOMWindow> openedWindow = impl->open(urlString, frameName
, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(in
fo.GetIsolate())); |
248 if (!openedWindow) | 248 if (!openedWindow) |
249 return; | 249 return; |
250 | 250 |
251 v8SetReturnValueFast(info, openedWindow.release(), impl); | 251 v8SetReturnValueFast(info, openedWindow.release(), impl); |
252 } | 252 } |
253 | 253 |
254 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 254 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
255 { | 255 { |
256 if (!name->IsString()) | |
257 return; | |
258 | |
259 auto nameString = name.As<v8::String>(); | 256 auto nameString = name.As<v8::String>(); |
260 DOMWindow* window = V8Window::toImpl(info.Holder()); | 257 DOMWindow* window = V8Window::toImpl(info.Holder()); |
261 if (!window) | 258 if (!window) |
262 return; | 259 return; |
263 | 260 |
264 Frame* frame = window->frame(); | 261 Frame* frame = window->frame(); |
265 // window is detached from a frame. | 262 // window is detached from a frame. |
266 if (!frame) | 263 if (!frame) |
267 return; | 264 return; |
268 | 265 |
269 // Note that the spec doesn't allow any cross-origin named access to the win
dow object. However, | 266 // Note that the spec doesn't allow any cross-origin named access to the win
dow object. However, |
270 // UAs have traditionally allowed named access to named child browsing conte
xts, even across | 267 // UAs have traditionally allowed named access to named child browsing conte
xts, even across |
271 // origins. So first, search child frames for a frame with a matching name. | 268 // origins. So first, search child frames for a frame with a matching name. |
272 AtomicString propName = toCoreAtomicString(nameString); | 269 AtomicString propName = toCoreAtomicString(nameString); |
273 Frame* child = frame->tree().scopedChild(propName); | 270 Frame* child = frame->tree().scopedChild(propName); |
274 if (child) { | 271 if (child) { |
275 v8SetReturnValueFast(info, child->domWindow(), window); | 272 v8SetReturnValueFast(info, child->domWindow(), window); |
276 return; | 273 return; |
277 } | 274 } |
278 | 275 |
279 // Search IDL functions defined in the prototype | |
280 if (!info.Holder()->GetRealNamedProperty(info.GetIsolate()->GetCurrentContex
t(), nameString).IsEmpty()) | |
281 return; | |
282 | |
283 // Frame could have been detached in call to GetRealNamedProperty. | |
284 frame = window->frame(); | |
285 // window is detached. | |
286 if (!frame) | |
287 return; | |
288 | |
289 // If the frame is remote, the caller will never be able to access further n
amed results. | 276 // If the frame is remote, the caller will never be able to access further n
amed results. |
290 if (!frame->isLocalFrame()) | 277 if (!frame->isLocalFrame()) |
291 return; | 278 return; |
292 | 279 |
293 // Search named items in the document. | 280 // Search named items in the document. |
294 Document* doc = toLocalFrame(frame)->document(); | 281 Document* doc = toLocalFrame(frame)->document(); |
295 if (!doc || !doc->isHTMLDocument()) | 282 if (!doc || !doc->isHTMLDocument()) |
296 return; | 283 return; |
297 | 284 |
298 // This is an AllCanRead interceptor. Check that the caller has access to t
he named results. | 285 // This is an AllCanRead interceptor. Check that the caller has access to t
he named results. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(isolate)); | 347 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(isolate)); |
361 if (context.IsEmpty()) | 348 if (context.IsEmpty()) |
362 return v8Undefined(); | 349 return v8Undefined(); |
363 | 350 |
364 v8::Local<v8::Object> global = context->Global(); | 351 v8::Local<v8::Object> global = context->Global(); |
365 ASSERT(!global.IsEmpty()); | 352 ASSERT(!global.IsEmpty()); |
366 return global; | 353 return global; |
367 } | 354 } |
368 | 355 |
369 } // namespace blink | 356 } // namespace blink |
OLD | NEW |