Changeset 84742 in webkit


Ignore:
Timestamp:
Apr 23, 2011 12:14:05 PM (13 years ago)
Author:
ap@apple.com
Message:

2011-04-23 Alexey Proskuryakov <ap@apple.com>

Unreviewed.

REGRESSION (r80812): window.print();window.close() doesn't work in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59241
<rdar://problem/9150861>

  • http/tests/misc/will-send-request-returns-null-on-redirect-expected.txt:
  • http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt:
  • http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt: Resource load delegates for cancelled loads are now correctly sent before frame load delegate's didFinishLoading, so cancellation errors get logged by DumpRenderTree.

2011-04-23 Alexey Proskuryakov <ap@apple.com>

Reviewed by Maciej Stachowiak.

REGRESSION (r80812): window.print();window.close() doesn't work in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=59241
<rdar://problem/9150861>

Covered by manual-tests/print-after-window-close.html.

Re-fixing <https://bugs.webkit.org/show_bug.cgi?id=51357> in a way that doesn't cause the
regression.

  • loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::didCancel): We shouldn't be doing complicated work while the loader is half-canceled.
  • manual-tests/print-after-window-close.html: Extended to actually print a non-empty page, thus being more practical.
  • page/Chrome.cpp: (WebCore::Chrome::print): Added a FIXME about a need for PageGroupLoadDeferrer. It's too scary for me to try now.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r84739 r84742  
     12011-04-23  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Unreviewed.
     4
     5        REGRESSION (r80812): window.print();window.close() doesn't work in WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59241
     7        <rdar://problem/9150861>
     8
     9        * http/tests/misc/will-send-request-returns-null-on-redirect-expected.txt:
     10        * http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt:
     11        * http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt:
     12        Resource load delegates for cancelled loads are now correctly sent before frame load
     13        delegate's didFinishLoading, so cancellation errors get logged by DumpRenderTree.
     14
    1152011-04-22  Chris Evans  <cevans@chromium.org>
    216
  • trunk/LayoutTests/http/tests/misc/will-send-request-returns-null-on-redirect-expected.txt

    r46455 r84742  
    33http://127.0.0.1:8000/misc/resources/redirect-to-http-url.php - willSendRequest <NSURLRequest URL http://www.example.com/, main document URL http://127.0.0.1:8000/misc/will-send-request-returns-null-on-redirect.html, http method GET> redirectResponse <NSURLResponse http://127.0.0.1:8000/misc/resources/redirect-to-http-url.php, http status code 302>
    44Returning null for this redirect
     5http://127.0.0.1:8000/misc/resources/redirect-to-http-url.php - didFailLoadingWithError: <NSError domain WebKitErrorDomain, code 102>
    56https://bugs.webkit.org/show_bug.cgi?id=27595
    67This test checks to make sure that things behave as expected when the resource load delegate returns null in response to willSendRequest.
  • trunk/LayoutTests/http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt

    r84060 r84742  
    33CONSOLE MESSAGE: line 1: Refused to display document because display forbidden by X-Frame-Options.
    44
     5http://127.0.0.1:8000/security/XFrameOptions/resources/x-frame-options-deny.cgi - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -999, failing URL "http://127.0.0.1:8000/security/XFrameOptions/resources/x-frame-options-deny.cgi">
    56There should be no content in the iframe below
    67
  • trunk/LayoutTests/http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt

    r84060 r84742  
    33CONSOLE MESSAGE: line 1: Refused to display document because display forbidden by X-Frame-Options.
    44
     5http://localhost:8000/security/XFrameOptions/resources/x-frame-options-parent-same-origin-allow.cgi - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -999, failing URL "http://localhost:8000/security/XFrameOptions/resources/x-frame-options-parent-same-origin-allow.cgi">
    56There should be no content in the iframe below
    67
  • trunk/Source/WebCore/ChangeLog

    r84741 r84742  
     12011-04-23  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        REGRESSION (r80812): window.print();window.close() doesn't work in WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=59241
     7        <rdar://problem/9150861>
     8
     9        Covered by manual-tests/print-after-window-close.html.
     10
     11        Re-fixing <https://bugs.webkit.org/show_bug.cgi?id=51357> in a way that doesn't cause the
     12        regression.
     13
     14        * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::didCancel): We shouldn't be
     15        doing complicated work while the loader is half-canceled.
     16
     17        * manual-tests/print-after-window-close.html: Extended to actually print a non-empty page,
     18        thus being more practical.
     19
     20        * page/Chrome.cpp: (WebCore::Chrome::print): Added a FIXME about a need for PageGroupLoadDeferrer.
     21        It's too scary for me to try now.
     22
     23        * page/DOMWindow.cpp:
     24        (WebCore::DOMWindow::DOMWindow):
     25        (WebCore::DOMWindow::finishedLoading):
     26        * page/DOMWindow.h:
     27        Reverted the previous fix for <https://bugs.webkit.org/show_bug.cgi?id=51357>.
     28
    1292011-04-19  Vitaly Repeshko  <vitalyr@chromium.org>
    230
  • trunk/Source/WebCore/loader/MainResourceLoader.cpp

    r84260 r84742  
    101101    m_dataLoadTimer.stop();
    102102
    103     // Calling receivedMainResourceError will likely result in the last reference to this object to go away.
    104     RefPtr<MainResourceLoader> protect(this);
     103    // FrameLoader won't be reachable after calling ResourceLoader::didCancel().
     104    FrameLoader* frameLoader = this->frameLoader();
    105105
    106106    if (m_waitingForContentPolicy) {
    107         frameLoader()->policyChecker()->cancelCheck();
     107        frameLoader->policyChecker()->cancelCheck();
    108108        ASSERT(m_waitingForContentPolicy);
    109109        m_waitingForContentPolicy = false;
    110110        deref(); // balances ref in didReceiveResponse
    111111    }
    112     frameLoader()->receivedMainResourceError(error, true);
    113112    ResourceLoader::didCancel(error);
     113
     114    // We should notify the frame loader after fully canceling the load, because it can do complicated work
     115    // like calling DOMWindow::print(), during which a half-canceled load could try to finish.
     116    frameLoader->receivedMainResourceError(error, true);
    114117}
    115118
  • trunk/Source/WebCore/manual-tests/print-after-window-close.html

    r80812 r84742  
    11<script>
    22function crash() {
    3     var w = window.open("data:text/html,foo");
     3    var w = window.open("data:text/html,Loading a data URL is asynchronous, so this text shouldn't appear. But it's most important to check that there is no crash after dismissing the print sheet.");
     4    w.document.write("SUCCESS");
    45    w.print();
    56    w.close();
  • trunk/Source/WebCore/page/Chrome.cpp

    r84371 r84742  
    431431void Chrome::print(Frame* frame)
    432432{
     433    // FIXME: This should have PageGroupLoadDeferrer, like runModal() or runJavaScriptAlert(), becasue it's no different from those.
    433434    m_client->print(frame);
    434435}
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r84224 r84742  
    396396    : m_shouldPrintWhenFinishedLoading(false)
    397397    , m_frame(frame)
    398     , m_printTimer(this, &DOMWindow::printTimerFired)
    399398{
    400399}
     
    955954}
    956955
    957 void DOMWindow::printTimerFired(Timer<DOMWindow>* timer)
    958 {
    959     ASSERT_UNUSED(timer, timer == &m_printTimer);
    960     print();
    961 }
    962 
    963956void DOMWindow::stop()
    964957{
     
    16351628    if (m_shouldPrintWhenFinishedLoading) {
    16361629        m_shouldPrintWhenFinishedLoading = false;
    1637 
    1638         m_printTimer.stop();
    1639         m_printTimer.startOneShot(0);
     1630        print();
    16401631    }
    16411632}
  • trunk/Source/WebCore/page/DOMWindow.h

    r84736 r84742  
    3131#include "MessagePort.h"
    3232#include "SecurityOrigin.h"
    33 #include "Timer.h"
    3433
    3534namespace WebCore {
     
    421420        virtual EventTargetData* ensureEventTargetData();
    422421
    423         void printTimerFired(Timer<DOMWindow>*);
    424 
    425422        static Frame* createWindow(const String& urlString, const AtomicString& frameName, const WindowFeatures&,
    426423            DOMWindow* activeWindow, Frame* firstFrame, Frame* openerFrame,
     
    448445        mutable RefPtr<StyleMedia> m_media;
    449446
    450         Timer<DOMWindow> m_printTimer;
    451 
    452447        EventTargetData m_eventTargetData;
    453448
Note: See TracChangeset for help on using the changeset viewer.