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

Side by Side Diff: Source/core/page/DOMWindow.cpp

Issue 22829002: Throw an exception when denying access to 'Frame's 'location' setter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Off by one. Created 7 years, 4 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
« Source/core/dom/ErrorEvent.h ('K') | « Source/core/page/DOMWindow.h ('k') | no next file » | 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 } 1579 }
1580 1580
1581 void DOMWindow::printErrorMessage(const String& message) 1581 void DOMWindow::printErrorMessage(const String& message)
1582 { 1582 {
1583 if (message.isEmpty()) 1583 if (message.isEmpty())
1584 return; 1584 return;
1585 1585
1586 pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); 1586 pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message);
1587 } 1587 }
1588 1588
1589 // FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target
1590 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with this method after considering
1591 // exactly which details may be exposed to JavaScript.
1592 //
1593 // http://crbug.com/17325
1594 String DOMWindow::sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow )
1595 {
1596 const KURL& activeWindowURL = activeWindow->document()->url();
1597 if (activeWindowURL.isNull())
1598 return String();
1599
1600 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se curityOrigin()));
1601
1602 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
1603 String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a cross-origin frame.";
1604
1605 // FIXME: Evaluate which details from 'crossDomainAccessErrorMessage' may sa fely be reported to JavaScript.
1606
1607 return message;
1608 }
1609
1589 String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow) 1610 String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow)
1590 { 1611 {
1591 const KURL& activeWindowURL = activeWindow->document()->url(); 1612 const KURL& activeWindowURL = activeWindow->document()->url();
1592 if (activeWindowURL.isNull()) 1613 if (activeWindowURL.isNull())
1593 return String(); 1614 return String();
1594 1615
1595 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se curityOrigin())); 1616 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se curityOrigin()));
1596 1617
1597 // FIXME: This message, and other console messages, have extra newlines. Sho uld remove them. 1618 // FIXME: This message, and other console messages, have extra newlines. Sho uld remove them.
1598 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin(); 1619 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier()); 1771 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN otifier());
1751 } 1772 }
1752 1773
1753 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() 1774 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
1754 { 1775 {
1755 return DOMWindowLifecycleNotifier::create(this); 1776 return DOMWindowLifecycleNotifier::create(this);
1756 } 1777 }
1757 1778
1758 1779
1759 } // namespace WebCore 1780 } // namespace WebCore
OLDNEW
« Source/core/dom/ErrorEvent.h ('K') | « Source/core/page/DOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698