| Differences between
and this patch
- a/Source/WebCore/ChangeLog +14 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2022-02-24  Youenn Fablet  <youenn@apple.com>
2
3
        Non-simple CORS preflight fails due to cache-control header
4
        https://bugs.webkit.org/show_bug.cgi?id=236837
5
        <rdar://problem/89382796>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        We fixed cache-control in https://bugs.webkit.org/show_bug.cgi?id=233916.
10
        The fix to make the website work is to ensure that Content-Type is not cleared when going to service worker.
11
        Covered by updated tests.
12
13
        * Modules/beacon/NavigatorBeacon.cpp:
14
1
2022-02-23  Youenn Fablet  <youenn@apple.com>
15
2022-02-23  Youenn Fablet  <youenn@apple.com>
2
16
3
        Allow to pass webrtc video frame buffers through RealtimeMediaSource based pipelines
17
        Allow to pass webrtc video frame buffers through RealtimeMediaSource based pipelines
- a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp -1 / +3 lines
Lines 145-152 ExceptionOr<bool> NavigatorBeacon::sendBeacon(Document& document, const String& a/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp_sec1
145
        request.setHTTPBody(fetchBody.bodyAsFormData());
145
        request.setHTTPBody(fetchBody.bodyAsFormData());
146
        if (!mimeType.isEmpty()) {
146
        if (!mimeType.isEmpty()) {
147
            request.setHTTPContentType(mimeType);
147
            request.setHTTPContentType(mimeType);
148
            if (!isCrossOriginSafeRequestHeader(HTTPHeaderName::ContentType, mimeType))
148
            if (!isCrossOriginSafeRequestHeader(HTTPHeaderName::ContentType, mimeType)) {
149
                options.mode = FetchOptions::Mode::Cors;
149
                options.mode = FetchOptions::Mode::Cors;
150
                options.httpHeadersToKeep.add(HTTPHeadersToKeepFromCleaning::ContentType);
151
            }
150
        }
152
        }
151
    }
153
    }
152
154
- a/LayoutTests/ChangeLog +11 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2022-02-24  Youenn Fablet  <youenn@apple.com>
2
3
        Non-simple CORS preflight fails due to cache-control header
4
        https://bugs.webkit.org/show_bug.cgi?id=236837
5
        <rdar://problem/89382796>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * http/wpt/service-workers/cache-control-request-expected.txt:
10
        * http/wpt/service-workers/cache-control-request.html:
11
1
2022-02-23  Alejandro G. Castro  <alex@igalia.com>
12
2022-02-23  Alejandro G. Castro  <alex@igalia.com>
2
13
3
        Unreviewed test gardening.
14
        Unreviewed test gardening.
- a/LayoutTests/http/wpt/service-workers/cache-control-request-expected.txt +1 lines
Lines 1-4 a/LayoutTests/http/wpt/service-workers/cache-control-request-expected.txt_sec1
1
1
2
PASS Setup worker
2
PASS Setup worker
3
PASS Ensure cache-control does not break service worker fetch handling
3
PASS Ensure cache-control does not break service worker fetch handling
4
PASS Ensure beacon headers are not broken by service worker fetch handling
4
5
- a/LayoutTests/http/wpt/service-workers/cache-control-request.html +16 lines
Lines 5-10 a/LayoutTests/http/wpt/service-workers/cache-control-request.html_sec1
5
<script src="/resources/testharnessreport.js"></script>
5
<script src="/resources/testharnessreport.js"></script>
6
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
6
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
7
<script src="/common/get-host-info.sub.js"></script>
7
<script src="/common/get-host-info.sub.js"></script>
8
<script src="/common/utils.js"></script>
8
</head>
9
</head>
9
<body>
10
<body>
10
<script>
11
<script>
Lines 33-38 promise_test(async (test) => { a/LayoutTests/http/wpt/service-workers/cache-control-request.html_sec2
33
    assert_not_equals(await response.text(), "no cache-control header");
34
    assert_not_equals(await response.text(), "no cache-control header");
34
    iframe.remove();
35
    iframe.remove();
35
}, "Ensure cache-control does not break service worker fetch handling");
36
}, "Ensure cache-control does not break service worker fetch handling");
37
38
promise_test(async (test) => {
39
    const iframe = await with_iframe("resources/empty.html");
40
41
    const id = token();
42
    const blob = new Blob(["test"], { type: "application/badabaoo" });
43
44
    iframe.contentWindow.navigator.sendBeacon(get_host_info().HTTP_REMOTE_ORIGIN +  "/WebKit/service-workers/resources/cross-origin-allow-for-beacon.py?token=" + id, blob);
45
    await new Promise(resolve => setTimeout(resolve, 50));
46
47
    const response = await fetch("/WebKit/service-workers/resources/cross-origin-allow-for-beacon.py?token=" + id);
48
    assert_equals(await response.text(), "preflight ok");
49
50
    iframe.remove();
51
}, "Ensure beacon headers are not broken by service worker fetch handling");
36
</script>
52
</script>
37
</body>
53
</body>
38
</html>
54
</html>

Return to Bug 236837