OLD | NEW |
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 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 } | 1569 } |
1570 | 1570 |
1571 void DOMWindow::printErrorMessage(const String& message) | 1571 void DOMWindow::printErrorMessage(const String& message) |
1572 { | 1572 { |
1573 if (message.isEmpty()) | 1573 if (message.isEmpty()) |
1574 return; | 1574 return; |
1575 | 1575 |
1576 pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); | 1576 pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message); |
1577 } | 1577 } |
1578 | 1578 |
| 1579 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
will always sanitize the target |
| 1580 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with
this method after considering |
| 1581 // exactly which details may be exposed to JavaScript. |
| 1582 // |
| 1583 // http://crbug.com/17325 |
| 1584 String DOMWindow::sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow
) |
| 1585 { |
| 1586 const KURL& activeWindowURL = activeWindow->document()->url(); |
| 1587 if (activeWindowURL.isNull()) |
| 1588 return String(); |
| 1589 |
| 1590 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se
curityOrigin())); |
| 1591 |
| 1592 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin(); |
| 1593 String message = "Blocked a frame with origin \"" + activeOrigin->toString()
+ "\" from accessing a cross-origin frame."; |
| 1594 |
| 1595 // FIXME: Evaluate which details from 'crossDomainAccessErrorMessage' may sa
fely be reported to JavaScript. |
| 1596 |
| 1597 return message; |
| 1598 } |
| 1599 |
1579 String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow) | 1600 String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow) |
1580 { | 1601 { |
1581 const KURL& activeWindowURL = activeWindow->document()->url(); | 1602 const KURL& activeWindowURL = activeWindow->document()->url(); |
1582 if (activeWindowURL.isNull()) | 1603 if (activeWindowURL.isNull()) |
1583 return String(); | 1604 return String(); |
1584 | 1605 |
1585 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se
curityOrigin())); | 1606 ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->se
curityOrigin())); |
1586 | 1607 |
1587 // FIXME: This message, and other console messages, have extra newlines. Sho
uld remove them. | 1608 // FIXME: This message, and other console messages, have extra newlines. Sho
uld remove them. |
1588 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin(); | 1609 SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN
otifier()); | 1761 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN
otifier()); |
1741 } | 1762 } |
1742 | 1763 |
1743 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() | 1764 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() |
1744 { | 1765 { |
1745 return DOMWindowLifecycleNotifier::create(this); | 1766 return DOMWindowLifecycleNotifier::create(this); |
1746 } | 1767 } |
1747 | 1768 |
1748 | 1769 |
1749 } // namespace WebCore | 1770 } // namespace WebCore |
OLD | NEW |