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

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

Issue 2877893002: Make UseCounter take a LocaFrame instead of any Frame (Closed)
Patch Set: Fix compile Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/TouchEvent.cpp » ('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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // None of these need to be RefPtr because info and context are guaranteed 204 // None of these need to be RefPtr because info and context are guaranteed
205 // to hold on to them. 205 // to hold on to them.
206 DOMWindow* window = V8Window::toImpl(info.Holder()); 206 DOMWindow* window = V8Window::toImpl(info.Holder());
207 // TODO(yukishiino): The HTML spec specifies that we should use the 207 // TODO(yukishiino): The HTML spec specifies that we should use the
208 // Incumbent Realm instead of the Current Realm, but currently we don't have 208 // Incumbent Realm instead of the Current Realm, but currently we don't have
209 // a way to retrieve the Incumbent Realm. See also: 209 // a way to retrieve the Incumbent Realm. See also:
210 // https://html.spec.whatwg.org/multipage/comms.html#dom-window-postmessage 210 // https://html.spec.whatwg.org/multipage/comms.html#dom-window-postmessage
211 LocalDOMWindow* source = CurrentDOMWindow(info.GetIsolate()); 211 LocalDOMWindow* source = CurrentDOMWindow(info.GetIsolate());
212 212
213 DCHECK(window); 213 DCHECK(window);
214 UseCounter::Count(window->GetFrame(), UseCounter::kWindowPostMessage); 214 UseCounter::Count(source->GetFrame(), UseCounter::kWindowPostMessage);
215 215
216 // If called directly by WebCore we don't have a calling context. 216 // If called directly by WebCore we don't have a calling context.
217 if (!source) { 217 if (!source) {
218 exception_state.ThrowTypeError("No active calling context exists."); 218 exception_state.ThrowTypeError("No active calling context exists.");
219 return; 219 return;
220 } 220 }
221 221
222 // This function has variable arguments and can be: 222 // This function has variable arguments and can be:
223 // postMessage(message, targetOrigin) 223 // postMessage(message, targetOrigin)
224 // postMessage(message, targetOrigin, {sequence of transferrables}) 224 // postMessage(message, targetOrigin, {sequence of transferrables})
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // Note that named access on WindowProxy is allowed in the cross-origin case. 306 // Note that named access on WindowProxy is allowed in the cross-origin case.
307 // 7.4.5 [[GetOwnProperty]] (P), step 6. 307 // 7.4.5 [[GetOwnProperty]] (P), step 6.
308 // https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-getownprop erty 308 // https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-getownprop erty
309 // 309 //
310 // 7.3.3 Named access on the Window object 310 // 7.3.3 Named access on the Window object
311 // The document-tree child browsing context name property set 311 // The document-tree child browsing context name property set
312 // https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-br owsing-context-name-property-set 312 // https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-br owsing-context-name-property-set
313 Frame* child = frame->Tree().ScopedChild(name); 313 Frame* child = frame->Tree().ScopedChild(name);
314 if (child) { 314 if (child) {
315 UseCounter::Count(window->GetFrame(), 315 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()),
316 UseCounter::kNamedAccessOnWindow_ChildBrowsingContext); 316 UseCounter::kNamedAccessOnWindow_ChildBrowsingContext);
317 317
318 // step 3. Remove each browsing context from childBrowsingContexts whose 318 // step 3. Remove each browsing context from childBrowsingContexts whose
319 // active document's origin is not same origin with activeDocument's origin 319 // active document's origin is not same origin with activeDocument's origin
320 // and whose browsing context name does not match the name of its browsing 320 // and whose browsing context name does not match the name of its browsing
321 // context container's name content attribute value. 321 // context container's name content attribute value.
322 if (BindingSecurity::ShouldAllowNamedAccessTo(window, child->DomWindow()) || 322 if (BindingSecurity::ShouldAllowNamedAccessTo(window, child->DomWindow()) ||
323 name == child->Owner()->BrowsingContextContainerName()) { 323 name == child->Owner()->BrowsingContextContainerName()) {
324 V8SetReturnValueFast(info, child->DomWindow(), window); 324 V8SetReturnValueFast(info, child->DomWindow(), window);
325 return; 325 return;
326 } 326 }
327 327
328 UseCounter::Count( 328 UseCounter::Count(
329 window->GetFrame(), 329 CurrentExecutionContext(info.GetIsolate()),
330 UseCounter:: 330 UseCounter::
331 kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch); 331 kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch);
332 // In addition to the above spec'ed case, we return the child window 332 // In addition to the above spec'ed case, we return the child window
333 // regardless of step 3 due to crbug.com/701489 for the time being. 333 // regardless of step 3 due to crbug.com/701489 for the time being.
334 // TODO(yukishiino): Makes iframe.name update the browsing context name 334 // TODO(yukishiino): Makes iframe.name update the browsing context name
335 // appropriately and makes the new name available in the named access on 335 // appropriately and makes the new name available in the named access on
336 // window. Then, removes the following two lines. 336 // window. Then, removes the following two lines.
337 V8SetReturnValueFast(info, child->DomWindow(), window); 337 V8SetReturnValueFast(info, child->DomWindow(), window);
338 return; 338 return;
339 } 339 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (items->HasExactlyOneItem()) { 376 if (items->HasExactlyOneItem()) {
377 V8SetReturnValueFast(info, items->item(0), window); 377 V8SetReturnValueFast(info, items->item(0), window);
378 return; 378 return;
379 } 379 }
380 V8SetReturnValueFast(info, items, window); 380 V8SetReturnValueFast(info, items, window);
381 return; 381 return;
382 } 382 }
383 } 383 }
384 384
385 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/TouchEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698