| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 729     if (frame()->isMainFrame() && allowFocus) | 729     if (frame()->isMainFrame() && allowFocus) | 
| 730         host->chromeClient().focus(); | 730         host->chromeClient().focus(); | 
| 731 | 731 | 
| 732     frame()->eventHandler().focusDocumentView(); | 732     frame()->eventHandler().focusDocumentView(); | 
| 733 } | 733 } | 
| 734 | 734 | 
| 735 void LocalDOMWindow::blur() | 735 void LocalDOMWindow::blur() | 
| 736 { | 736 { | 
| 737 } | 737 } | 
| 738 | 738 | 
| 739 void LocalDOMWindow::close(ExecutionContext* context) |  | 
| 740 { |  | 
| 741     if (!frame() || !frame()->isMainFrame()) |  | 
| 742         return; |  | 
| 743 |  | 
| 744     Page* page = frame()->page(); |  | 
| 745     if (!page) |  | 
| 746         return; |  | 
| 747 |  | 
| 748     if (context) { |  | 
| 749         ASSERT(isMainThread()); |  | 
| 750         Document* activeDocument = toDocument(context); |  | 
| 751         if (!activeDocument) |  | 
| 752             return; |  | 
| 753 |  | 
| 754         if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*f
      rame())) |  | 
| 755             return; |  | 
| 756     } |  | 
| 757 |  | 
| 758     Settings* settings = frame()->settings(); |  | 
| 759     bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
      indows(); |  | 
| 760 |  | 
| 761     if (!page->openedByDOM() && frame()->loader().client()->backForwardLength() 
      > 1 && !allowScriptsToCloseWindows) { |  | 
| 762         frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni
      ngMessageLevel, "Scripts may close only the windows that were opened by it.")); |  | 
| 763         return; |  | 
| 764     } |  | 
| 765 |  | 
| 766     if (!frame()->loader().shouldClose()) |  | 
| 767         return; |  | 
| 768 |  | 
| 769     InspectorInstrumentation::willCloseWindow(context); |  | 
| 770 |  | 
| 771     page->chromeClient().closeWindowSoon(); |  | 
| 772     // So as to make window.closed return the expected result |  | 
| 773     // after window.close(), separately record the to-be-closed |  | 
| 774     // state of this window. Scripts may access window.closed |  | 
| 775     // before the deferred close operation has gone ahead. |  | 
| 776     m_windowIsClosing = true; |  | 
| 777 } |  | 
| 778 |  | 
| 779 void LocalDOMWindow::print() | 739 void LocalDOMWindow::print() | 
| 780 { | 740 { | 
| 781     if (!frame()) | 741     if (!frame()) | 
| 782         return; | 742         return; | 
| 783 | 743 | 
| 784     FrameHost* host = frame()->host(); | 744     FrameHost* host = frame()->host(); | 
| 785     if (!host) | 745     if (!host) | 
| 786         return; | 746         return; | 
| 787 | 747 | 
| 788     if (frame()->document()->isSandboxed(SandboxModals)) { | 748     if (frame()->document()->isSandboxed(SandboxModals)) { | 
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1503     DOMWindow::trace(visitor); | 1463     DOMWindow::trace(visitor); | 
| 1504     DOMWindowLifecycleNotifier::trace(visitor); | 1464     DOMWindowLifecycleNotifier::trace(visitor); | 
| 1505 } | 1465 } | 
| 1506 | 1466 | 
| 1507 LocalFrame* LocalDOMWindow::frame() const | 1467 LocalFrame* LocalDOMWindow::frame() const | 
| 1508 { | 1468 { | 
| 1509     return m_frameObserver->frame(); | 1469     return m_frameObserver->frame(); | 
| 1510 } | 1470 } | 
| 1511 | 1471 | 
| 1512 } // namespace blink | 1472 } // namespace blink | 
| OLD | NEW | 
|---|