| Differences between
and this patch
- WebCore/ChangeLog +20 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-09-03  Michael Nordman  <michaeln@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        https://bugs.webkit.org/show_bug.cgi?id=28359
6
        Cleanup: Undo some accidental changes around DOMApplicationCache.
7
        - Restore support for constructing a DOMApplicationCache object with a null frame ptr.
8
        - Return a non-null object for window.applicationCache when the feature is disabled.
9
        - Simplify the swapCache method.
10
11
        Test: http/tests/appcache/disabled.html
12
13
        * loader/appcache/DOMApplicationCache.cpp:
14
        (WebCore::DOMApplicationCache::DOMApplicationCache):
15
        (WebCore::DOMApplicationCache::swapCache):
16
        (WebCore::DOMApplicationCache::scriptExecutionContext):
17
        * loader/appcache/DOMApplicationCache.h:
18
        * page/DOMWindow.cpp:
19
        (WebCore::DOMWindow::applicationCache):
20
1
2009-09-03  Alexey Proskuryakov  <ap@apple.com>
21
2009-09-03  Alexey Proskuryakov  <ap@apple.com>
2
22
3
        Reviewed by Darin Adler.
23
        Reviewed by Darin Adler.
- WebCore/loader/appcache/DOMApplicationCache.cpp -12 / +7 lines
Lines 42-49 namespace WebCore { WebCore/loader/appcache/DOMApplicationCache.cpp_sec1
42
DOMApplicationCache::DOMApplicationCache(Frame* frame)
42
DOMApplicationCache::DOMApplicationCache(Frame* frame)
43
    : m_frame(frame)
43
    : m_frame(frame)
44
{
44
{
45
    ASSERT(applicationCacheHost());
45
    ASSERT(!m_frame || applicationCacheHost());
46
    applicationCacheHost()->setDOMApplicationCache(this);
46
    ApplicationCacheHost* cacheHost = applicationCacheHost();
47
    if (cacheHost)
48
        cacheHost->setDOMApplicationCache(this);
47
}
49
}
48
50
49
void DOMApplicationCache::disconnectFrame()
51
void DOMApplicationCache::disconnectFrame()
Lines 76-97 void DOMApplicationCache::update(Excepti WebCore/loader/appcache/DOMApplicationCache.cpp_sec2
76
        ec = INVALID_STATE_ERR;
78
        ec = INVALID_STATE_ERR;
77
}
79
}
78
80
79
bool DOMApplicationCache::swapCache()
80
{
81
    ApplicationCacheHost* cacheHost = applicationCacheHost();
82
    if (!cacheHost)
83
        return false;
84
    return cacheHost->swapCache();
85
}
86
    
87
void DOMApplicationCache::swapCache(ExceptionCode& ec)
81
void DOMApplicationCache::swapCache(ExceptionCode& ec)
88
{
82
{
89
    if (!swapCache())
83
    ApplicationCacheHost* cacheHost = applicationCacheHost();
84
    if (!cacheHost || !cacheHost->swapCache())
90
        ec = INVALID_STATE_ERR;
85
        ec = INVALID_STATE_ERR;
91
}
86
}
92
87
93
ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const
88
ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const
94
{
89
{
90
    ASSERT(m_frame);
95
    return m_frame->document();
91
    return m_frame->document();
96
}
92
}
97
93
Lines 209-215 ApplicationCacheHost::EventID DOMApplica WebCore/loader/appcache/DOMApplicationCache.cpp_sec3
209
    return ApplicationCacheHost::ERROR_EVENT;
205
    return ApplicationCacheHost::ERROR_EVENT;
210
}
206
}
211
207
212
213
} // namespace WebCore
208
} // namespace WebCore
214
209
215
#endif // ENABLE(OFFLINE_WEB_APPLICATIONS)
210
#endif // ENABLE(OFFLINE_WEB_APPLICATIONS)
- WebCore/loader/appcache/DOMApplicationCache.h -1 lines
Lines 115-121 private: WebCore/loader/appcache/DOMApplicationCache.h_sec1
115
    virtual void derefEventTarget() { deref(); }
115
    virtual void derefEventTarget() { deref(); }
116
116
117
    ApplicationCacheHost* applicationCacheHost() const;
117
    ApplicationCacheHost* applicationCacheHost() const;
118
    bool swapCache();
119
    
118
    
120
    RefPtr<EventListener> m_attributeEventListeners[ApplicationCacheHost::OBSOLETE_EVENT + 1];
119
    RefPtr<EventListener> m_attributeEventListeners[ApplicationCacheHost::OBSOLETE_EVENT + 1];
121
120
- WebCore/page/DOMWindow.cpp -1 / +1 lines
Lines 528-534 Console* DOMWindow::console() const WebCore/page/DOMWindow.cpp_sec1
528
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
528
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
529
DOMApplicationCache* DOMWindow::applicationCache() const
529
DOMApplicationCache* DOMWindow::applicationCache() const
530
{
530
{
531
    if (!m_applicationCache && m_frame && m_frame->settings() && m_frame->settings()->offlineWebApplicationCacheEnabled())
531
    if (!m_applicationCache)
532
        m_applicationCache = DOMApplicationCache::create(m_frame);
532
        m_applicationCache = DOMApplicationCache::create(m_frame);
533
    return m_applicationCache.get();
533
    return m_applicationCache.get();
534
}
534
}
- LayoutTests/ChangeLog +11 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2009-09-03  Michael Nordman  <michaeln@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        https://bugs.webkit.org/show_bug.cgi?id=28359
6
        Test to ensure the the window.applicationCache attribute is defined but non-functional
7
        with the feature disabled.
8
9
        * http/tests/appcache/disabled-expected.txt: Added.
10
        * http/tests/appcache/disabled.html: Added.
11
1
2009-09-03  Alexey Proskuryakov  <ap@apple.com>
12
2009-09-03  Alexey Proskuryakov  <ap@apple.com>
2
13
3
        Reviewed by Darin Adler.
14
        Reviewed by Darin Adler.
- LayoutTests/http/tests/appcache/disabled-expected.txt +4 lines
Line 0 LayoutTests/http/tests/appcache/disabled-expected.txt_sec1
1
Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.
2
3
SUCCESS
4
- LayoutTests/http/tests/appcache/disabled.html +51 lines
Line 0 LayoutTests/http/tests/appcache/disabled.html_sec1
1
<html>
2
<body>
3
<p>Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.</p>
4
<div id=result></div>
5
<script>
6
    if (window.layoutTestController) {
7
        layoutTestController.overridePreference("WebKitOfflineWebApplicationCacheEnabled", false);
8
        layoutTestController.dumpAsText();
9
    }
10
11
    function log(message)
12
    {
13
        document.getElementById("result").innerHTML += message + "<br>";
14
    }
15
16
    function isDefined() {
17
        if (window.applicationCache)
18
            return true;
19
        else
20
            return false;
21
    }
22
23
    function statusIsUncached() {
24
        return applicationCache.status == 0;
25
    }
26
27
    function swapThrows() {
28
        try {
29
            applicationCache.swapCache();
30
            return false;
31
        } catch(e) {
32
            return true;
33
        }
34
    }
35
36
    function updateThrows() {
37
        try {
38
            applicationCache.swapCache();
39
            return false;
40
        } catch(e) {
41
            return true;
42
        }
43
    }
44
45
    if (isDefined() && statusIsUncached() && swapThrows() && updateThrows())
46
        log("SUCCESS");
47
    else
48
        log("FAILURE");
49
</script>
50
</body>
51
</html>

Return to Bug 28359