| Differences between
and this patch
- a/Source/WebCore/ChangeLog +31 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2017-09-08  Frederic Wang  <fwang@igalia.com>
2
3
        Use RenderLayerBacking::renderer() when possible
4
        https://bugs.webkit.org/show_bug.cgi?id=176585
5
6
        The private member renderer() is a shorthand for m_owningLayer.renderer(). This patch uses
7
        it in RenderLayerBacking when possible.
8
9
        Reviewed by Carlos Garcia Campos.
10
11
        No new tests, behavior not changed.
12
13
        * rendering/RenderLayerBacking.cpp:
14
        (WebCore::RenderLayerBacking::updateGeometry):
15
        (WebCore::RenderLayerBacking::setContentsNeedDisplay):
16
        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
17
18
2017-09-07  Joseph Pecoraro  <pecoraro@apple.com>
19
20
        WebKit should claim that it can show responses for a broader range of JSON MIMETypes
21
        https://bugs.webkit.org/show_bug.cgi?id=176252
22
        <rdar://problem/34212885>
23
24
        Reviewed by Ryosuke Niwa.
25
26
        * platform/MIMETypeRegistry.h:
27
        * platform/MIMETypeRegistry.cpp:
28
        (WebCore::MIMETypeRegistry::canShowMIMEType):
29
        Extend this to support JavaScript and JSON MIMETypes that WebKit
30
        knows how to treat as text.
31
1
2017-09-07  Andy Estes  <aestes@apple.com>
32
2017-09-07  Andy Estes  <aestes@apple.com>
2
33
3
        [Mac] Upstream QTKit-related WebKitSystemInterface functions
34
        [Mac] Upstream QTKit-related WebKitSystemInterface functions
- a/Source/WebKit/ChangeLog +15 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2017-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        [GTK][WPE] UI process crash in WebBackForwardList::restoreFromState
4
        https://bugs.webkit.org/show_bug.cgi?id=176303
5
6
        Reviewed by Michael Catanzaro.
7
8
        Ensure the current index provided by the session state is not out of actual item list bounds. This is a bug in
9
        the session state decoder, but WebBackForwardList::backForwardListState() is already doing the check and using
10
        the last item index instead, so it's not easy to know where the actual problem is. In any case we should
11
        still protect the decoder.
12
13
        * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
14
        (decodeSessionState):
15
1
2017-09-07  Andy Estes  <aestes@apple.com>
16
2017-09-07  Andy Estes  <aestes@apple.com>
2
17
3
        [Mac] Upstream QTKit-related WebKitSystemInterface functions
18
        [Mac] Upstream QTKit-related WebKitSystemInterface functions
- a/Source/WebCore/platform/MIMETypeRegistry.cpp -1 / +4 lines
Lines 102-108 static void initializeSupportedImageMIMETypes() a/Source/WebCore/platform/MIMETypeRegistry.cpp_sec1
102
    // These were removed for <rdar://problem/6564538> Re-enable UTI code in WebCore now that MobileCoreServices exists
102
    // These were removed for <rdar://problem/6564538> Re-enable UTI code in WebCore now that MobileCoreServices exists
103
    // But Mail relies on at least image/tif reported as being supported (should be image/tiff).
103
    // But Mail relies on at least image/tif reported as being supported (should be image/tiff).
104
    // This can be removed when Mail addresses:
104
    // This can be removed when Mail addresses:
105
    // <rdar://problem/7879510> Mail should use standard image mimetypes 
105
    // <rdar://problem/7879510> Mail should use standard image mimetypes
106
    // and we fix sniffing so that it corrects items such as image/jpg -> image/jpeg.
106
    // and we fix sniffing so that it corrects items such as image/jpg -> image/jpeg.
107
    static const char* const malformedMIMETypes[] = {
107
    static const char* const malformedMIMETypes[] = {
108
        // JPEG (image/jpeg)
108
        // JPEG (image/jpeg)
Lines 639-644 bool MIMETypeRegistry::canShowMIMEType(const String& mimeType) a/Source/WebCore/platform/MIMETypeRegistry.cpp_sec2
639
    if (isSupportedImageMIMEType(mimeType) || isSupportedNonImageMIMEType(mimeType) || isSupportedMediaMIMEType(mimeType))
639
    if (isSupportedImageMIMEType(mimeType) || isSupportedNonImageMIMEType(mimeType) || isSupportedMediaMIMEType(mimeType))
640
        return true;
640
        return true;
641
641
642
    if (isSupportedJavaScriptMIMEType(mimeType) || isSupportedJSONMIMEType(mimeType))
643
        return true;
644
642
    if (mimeType.startsWith("text/", false))
645
    if (mimeType.startsWith("text/", false))
643
        return !isUnsupportedTextMIMEType(mimeType);
646
        return !isUnsupportedTextMIMEType(mimeType);
644
647
- a/Source/WebCore/platform/MIMETypeRegistry.h -6 / +7 lines
Lines 58-65 public: a/Source/WebCore/platform/MIMETypeRegistry.h_sec1
58
    static bool isSupportedImageMIMETypeForEncoding(const String& mimeType);
58
    static bool isSupportedImageMIMETypeForEncoding(const String& mimeType);
59
59
60
    // Check to see if a MIME type is suitable for being loaded as a JavaScript or JSON resource.
60
    // Check to see if a MIME type is suitable for being loaded as a JavaScript or JSON resource.
61
    static bool isSupportedJavaScriptMIMEType(const String& mimeType);
61
    WEBCORE_EXPORT static bool isSupportedJavaScriptMIMEType(const String& mimeType);
62
    static bool isSupportedJSONMIMEType(const String& mimeType);
62
    WEBCORE_EXPORT static bool isSupportedJSONMIMEType(const String& mimeType);
63
63
64
    // Check to see if a MIME type is suitable for being loaded as a style sheet.
64
    // Check to see if a MIME type is suitable for being loaded as a style sheet.
65
    static bool isSupportedStyleSheetMIMEType(const String& mimeType);
65
    static bool isSupportedStyleSheetMIMEType(const String& mimeType);
Lines 68-74 public: a/Source/WebCore/platform/MIMETypeRegistry.h_sec2
68
    static bool isSupportedFontMIMEType(const String& mimeType);
68
    static bool isSupportedFontMIMEType(const String& mimeType);
69
69
70
    // Check to see if a non-image MIME type is suitable for being loaded as a
70
    // Check to see if a non-image MIME type is suitable for being loaded as a
71
    // document in a frame. Includes supported JavaScript MIME types.
71
    // document in a frame. Does not include supported JavaScript and JSON MIME types.
72
    WEBCORE_EXPORT static bool isSupportedNonImageMIMEType(const String& mimeType);
72
    WEBCORE_EXPORT static bool isSupportedNonImageMIMEType(const String& mimeType);
73
73
74
    // Check to see if a MIME type is suitable for being loaded using <video> and <audio>.
74
    // Check to see if a MIME type is suitable for being loaded using <video> and <audio>.
Lines 88-96 public: a/Source/WebCore/platform/MIMETypeRegistry.h_sec3
88
    static bool isPDFMIMEType(const String& mimeType);
88
    static bool isPDFMIMEType(const String& mimeType);
89
89
90
    // Check to see if a MIME type is suitable for being shown inside a page.
90
    // Check to see if a MIME type is suitable for being shown inside a page.
91
    // Returns true if any of isSupportedImageMIMEType(), isSupportedNonImageMIMEType(), or
91
    // Returns true if any of isSupportedImageMIMEType(), isSupportedNonImageMIMEType(),
92
    // isSupportedMediaMIMEType() returns true or if the given MIME type begins with
92
    // isSupportedMediaMIMEType(), isSupportedJavaScriptMIMEType(), isSupportedJSONMIMEType(),
93
    // "text/" and isUnsupportedTextMIMEType() returns false.
93
    // returns true or if the given MIME type begins with "text/" and
94
    // isUnsupportedTextMIMEType() returns false.
94
    WEBCORE_EXPORT static bool canShowMIMEType(const String& mimeType);
95
    WEBCORE_EXPORT static bool canShowMIMEType(const String& mimeType);
95
96
96
    // Check to see if a MIME type is one where an XML document should be created
97
    // Check to see if a MIME type is one where an XML document should be created
- a/Source/WebCore/rendering/RenderLayerBacking.cpp -3 / +3 lines
Lines 1052-1058 void RenderLayerBacking::updateGeometry() a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec1
1052
    if (m_maskLayer)
1052
    if (m_maskLayer)
1053
        updateMaskingLayerGeometry();
1053
        updateMaskingLayerGeometry();
1054
    
1054
    
1055
    if (m_owningLayer.renderer().hasTransformRelatedProperty()) {
1055
    if (renderer().hasTransformRelatedProperty()) {
1056
        // Update properties that depend on layer dimensions.
1056
        // Update properties that depend on layer dimensions.
1057
        FloatPoint3D transformOrigin = computeTransformOriginForPainting(downcast<RenderBox>(renderer()).borderBoxRect());
1057
        FloatPoint3D transformOrigin = computeTransformOriginForPainting(downcast<RenderBox>(renderer()).borderBoxRect());
1058
        FloatPoint layerOffset = roundPointToDevicePixels(toLayoutPoint(rendererOffset.fromParentGraphicsLayer()), deviceScaleFactor());
1058
        FloatPoint layerOffset = roundPointToDevicePixels(toLayoutPoint(rendererOffset.fromParentGraphicsLayer()), deviceScaleFactor());
Lines 2433-2439 void RenderLayerBacking::setContentsNeedDisplay(GraphicsLayer::ShouldClipToLayer a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec2
2433
{
2433
{
2434
    ASSERT(!paintsIntoCompositedAncestor());
2434
    ASSERT(!paintsIntoCompositedAncestor());
2435
2435
2436
    FrameView& frameView = owningLayer().renderer().view().frameView();
2436
    FrameView& frameView = renderer().view().frameView();
2437
    if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
2437
    if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
2438
        frameView.addTrackedRepaintRect(owningLayer().absoluteBoundingBoxForPainting());
2438
        frameView.addTrackedRepaintRect(owningLayer().absoluteBoundingBoxForPainting());
2439
    
2439
    
Lines 2468-2474 void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r, Graph a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec3
2468
    ASSERT(!paintsIntoCompositedAncestor());
2468
    ASSERT(!paintsIntoCompositedAncestor());
2469
2469
2470
    FloatRect pixelSnappedRectForPainting = snapRectToDevicePixels(r, deviceScaleFactor());
2470
    FloatRect pixelSnappedRectForPainting = snapRectToDevicePixels(r, deviceScaleFactor());
2471
    FrameView& frameView = owningLayer().renderer().view().frameView();
2471
    FrameView& frameView = renderer().view().frameView();
2472
    if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
2472
    if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
2473
        frameView.addTrackedRepaintRect(pixelSnappedRectForPainting);
2473
        frameView.addTrackedRepaintRect(pixelSnappedRectForPainting);
2474
2474
- a/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp -1 / +1 lines
Lines 369-375 static bool decodeSessionState(GBytes* data, SessionState& sessionState) a/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp_sec1
369
    decodeBackForwardListItemState(backForwardListStateIter.get(), sessionState.backForwardListState);
369
    decodeBackForwardListItemState(backForwardListStateIter.get(), sessionState.backForwardListState);
370
370
371
    if (hasCurrentIndex)
371
    if (hasCurrentIndex)
372
        sessionState.backForwardListState.currentIndex = currentIndex;
372
        sessionState.backForwardListState.currentIndex = std::min<uint32_t>(currentIndex, sessionState.backForwardListState.items.size() - 1);
373
    return true;
373
    return true;
374
}
374
}
375
375
- a/Tools/ChangeLog +27 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2017-09-07  Joseph Pecoraro  <pecoraro@apple.com>
2
3
        WebKit should claim that it can show responses for a broader range of JSON MIMETypes
4
        https://bugs.webkit.org/show_bug.cgi?id=176252
5
        <rdar://problem/34212885>
6
7
        Reviewed by Ryosuke Niwa.
8
9
        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
10
        * TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm: Added.
11
        (-[WKNavigationResponseTestNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]):
12
        (-[WKNavigationResponseTestNavigationDelegate webView:didCommitNavigation:]):
13
        (-[WKNavigationResponseTestSchemeHandler webView:startURLSchemeTask:]):
14
        (-[WKNavigationResponseTestSchemeHandler webView:stopURLSchemeTask:]):
15
        (TEST):
16
        Test for canShowMIMEType with multiple JSON mime types and a garbage mime type.
17
        Previously canShowMIMEType would have been YES for "application/json" but
18
        NO for "application/vnd.api+json". Now it shows YES for both.
19
20
        * TestWebKitAPI/PlatformGTK.cmake:
21
        * TestWebKitAPI/PlatformWPE.cmake:
22
        * TestWebKitAPI/PlatformWin.cmake:
23
        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
24
        * TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp: Added.
25
        (TestWebKitAPI::TEST):
26
        Tests for MIMETypeRegistry's dynamic JSON mime type detection.
27
1
2017-09-07  Matthew Stewart  <matthew_r_stewart@apple.com>
28
2017-09-07  Matthew Stewart  <matthew_r_stewart@apple.com>
2
29
3
        Add Live PLT implemented with WebDriver
30
        Add Live PLT implemented with WebDriver
- a/Tools/TestWebKitAPI/PlatformGTK.cmake +1 lines
Lines 136-141 add_executable(TestWebCore a/Tools/TestWebKitAPI/PlatformGTK.cmake_sec1
136
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp
136
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/GridPosition.cpp
137
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
137
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
138
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
138
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
139
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
139
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
140
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
140
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
141
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
141
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
142
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
- a/Tools/TestWebKitAPI/PlatformWPE.cmake +1 lines
Lines 45-50 add_executable(TestWebCore a/Tools/TestWebKitAPI/PlatformWPE.cmake_sec1
45
    ${TESTWEBKITAPI_DIR}/TestsController.cpp
45
    ${TESTWEBKITAPI_DIR}/TestsController.cpp
46
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
46
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
47
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
47
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
48
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
48
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/URL.cpp
49
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/URL.cpp
49
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
50
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
50
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
51
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBufferTest.cpp
- a/Tools/TestWebKitAPI/PlatformWin.cmake +1 lines
Lines 57-62 set(TestWebCoreLib_SOURCES a/Tools/TestWebKitAPI/PlatformWin.cmake_sec1
57
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/IntPoint.cpp
57
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/IntPoint.cpp
58
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/IntSize.cpp
58
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/IntSize.cpp
59
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
59
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
60
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/MIMETypeRegistry.cpp
60
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/ParsedContentRange.cpp
61
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/ParsedContentRange.cpp
61
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
62
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
62
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
63
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +8 lines
Lines 569-574 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec1
569
		A57D54F31F338C3600A97AA7 /* NeverDestroyed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F21F338C3600A97AA7 /* NeverDestroyed.cpp */; };
569
		A57D54F31F338C3600A97AA7 /* NeverDestroyed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F21F338C3600A97AA7 /* NeverDestroyed.cpp */; };
570
		A57D54F61F3395D000A97AA7 /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F41F3395D000A97AA7 /* Logger.cpp */; };
570
		A57D54F61F3395D000A97AA7 /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F41F3395D000A97AA7 /* Logger.cpp */; };
571
		A57D54F91F3397B400A97AA7 /* LifecycleLogger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F71F3397B400A97AA7 /* LifecycleLogger.cpp */; };
571
		A57D54F91F3397B400A97AA7 /* LifecycleLogger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A57D54F71F3397B400A97AA7 /* LifecycleLogger.cpp */; };
572
		A5A729F11F622AA700DE5A28 /* WKNavigationResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A729F01F622A9A00DE5A28 /* WKNavigationResponse.mm */; };
573
		A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5B149DD1F5A19DC00C6DAFF /* MIMETypeRegistry.cpp */; };
572
		A5E2027515B21F6E00C13E14 /* WindowlessWebViewWithMedia.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */; };
574
		A5E2027515B21F6E00C13E14 /* WindowlessWebViewWithMedia.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */; };
573
		AD57AC201DA7465000FF1BDE /* DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD57AC1E1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp */; };
575
		AD57AC201DA7465000FF1BDE /* DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD57AC1E1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp */; };
574
		AD57AC211DA7465B00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD57AC1F1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp */; };
576
		AD57AC211DA7465B00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD57AC1F1DA7464D00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp */; };
Lines 1512-1517 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec2
1512
		A57D54F51F3395D000A97AA7 /* Logger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
1514
		A57D54F51F3395D000A97AA7 /* Logger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
1513
		A57D54F71F3397B400A97AA7 /* LifecycleLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LifecycleLogger.cpp; sourceTree = "<group>"; };
1515
		A57D54F71F3397B400A97AA7 /* LifecycleLogger.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LifecycleLogger.cpp; sourceTree = "<group>"; };
1514
		A57D54F81F3397B400A97AA7 /* LifecycleLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LifecycleLogger.h; sourceTree = "<group>"; };
1516
		A57D54F81F3397B400A97AA7 /* LifecycleLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LifecycleLogger.h; sourceTree = "<group>"; };
1517
		A5A729F01F622A9A00DE5A28 /* WKNavigationResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigationResponse.mm; sourceTree = "<group>"; };
1518
		A5B149DD1F5A19DC00C6DAFF /* MIMETypeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MIMETypeRegistry.cpp; sourceTree = "<group>"; };
1515
		A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WindowlessWebViewWithMedia.html; sourceTree = "<group>"; };
1519
		A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WindowlessWebViewWithMedia.html; sourceTree = "<group>"; };
1516
		A5E2027215B2181900C13E14 /* WindowlessWebViewWithMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowlessWebViewWithMedia.mm; sourceTree = "<group>"; };
1520
		A5E2027215B2181900C13E14 /* WindowlessWebViewWithMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowlessWebViewWithMedia.mm; sourceTree = "<group>"; };
1517
		A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
1521
		A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
Lines 1990-1995 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec3
1990
				2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */,
1994
				2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */,
1991
				370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */,
1995
				370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */,
1992
				51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */,
1996
				51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */,
1997
				A5A729F01F622A9A00DE5A28 /* WKNavigationResponse.mm */,
1993
				375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
1998
				375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
1994
				37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
1999
				37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
1995
				A14AAB611E78D7DE00C1ADC2 /* WKPDFView.mm */,
2000
				A14AAB611E78D7DE00C1ADC2 /* WKPDFView.mm */,
Lines 2067-2072 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec4
2067
				7A909A751D877475007E10F8 /* IntSize.cpp */,
2072
				7A909A751D877475007E10F8 /* IntSize.cpp */,
2068
				14464012167A8305000BD218 /* LayoutUnit.cpp */,
2073
				14464012167A8305000BD218 /* LayoutUnit.cpp */,
2069
				076E507E1F45031E006E9F5A /* Logging.cpp */,
2074
				076E507E1F45031E006E9F5A /* Logging.cpp */,
2075
				A5B149DD1F5A19DC00C6DAFF /* MIMETypeRegistry.cpp */,
2070
				CD225C071C45A69200140761 /* ParsedContentRange.cpp */,
2076
				CD225C071C45A69200140761 /* ParsedContentRange.cpp */,
2071
				CDCFA7A91E45122F00C2433D /* SampleMap.cpp */,
2077
				CDCFA7A91E45122F00C2433D /* SampleMap.cpp */,
2072
				CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */,
2078
				CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */,
Lines 3264-3269 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec5
3264
				5C0BF88D1DD5964D00B00328 /* MemoryPressureHandler.mm in Sources */,
3270
				5C0BF88D1DD5964D00B00328 /* MemoryPressureHandler.mm in Sources */,
3265
				7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */,
3271
				7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */,
3266
				5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */,
3272
				5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */,
3273
				A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */,
3267
				51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */,
3274
				51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */,
3268
				7C83E0B61D0A64B300FEBCF3 /* ModalAlertsSPI.cpp in Sources */,
3275
				7C83E0B61D0A64B300FEBCF3 /* ModalAlertsSPI.cpp in Sources */,
3269
				7CCE7F011A411AE600447C4C /* MouseMoveAfterCrash.cpp in Sources */,
3276
				7CCE7F011A411AE600447C4C /* MouseMoveAfterCrash.cpp in Sources */,
Lines 3400-3405 a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj_sec6
3400
				370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */,
3407
				370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */,
3401
				51D124981E763B02002B2820 /* WKHTTPCookieStore.mm in Sources */,
3408
				51D124981E763B02002B2820 /* WKHTTPCookieStore.mm in Sources */,
3402
				7CCE7F1D1A411AE600447C4C /* WKImageCreateCGImageCrash.cpp in Sources */,
3409
				7CCE7F1D1A411AE600447C4C /* WKImageCreateCGImageCrash.cpp in Sources */,
3410
				A5A729F11F622AA700DE5A28 /* WKNavigationResponse.mm in Sources */,
3403
				375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */,
3411
				375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */,
3404
				37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */,
3412
				37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */,
3405
				7C89D2AC1A69B80D003A5FDE /* WKPageConfiguration.cpp in Sources */,
3413
				7C89D2AC1A69B80D003A5FDE /* WKPageConfiguration.cpp in Sources */,
- a/Tools/TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp +83 lines
Line 0 a/Tools/TestWebKitAPI/Tests/WebCore/MIMETypeRegistry.cpp_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
28
#include <WebCore/MIMETypeRegistry.h>
29
30
using namespace WebCore;
31
32
namespace TestWebKitAPI {
33
34
TEST(MIMETypeRegistry, JSONMIMETypes)
35
{
36
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJSONMIMEType("application/json"));
37
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJSONMIMEType("APPLICATION/JSON"));
38
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJSONMIMEType("application/vnd.api+json"));
39
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJSONMIMEType("anything/something+json"));
40
41
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJSONMIMEType("text/plain"));
42
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJSONMIMEType("text/json"));
43
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJSONMIMEType("text/javascript"));
44
}
45
46
TEST(MIMETypeRegistry, JavaScriptMIMETypes)
47
{
48
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("text/javascript"));
49
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("TEXT/JAVASCRIPT"));
50
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("application/javascript"));
51
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("application/ecmascript"));
52
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("application/x-javascript"));
53
    ASSERT_TRUE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("application/x-ecmascript"));
54
55
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("text/plain"));
56
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("application/json"));
57
    ASSERT_FALSE(MIMETypeRegistry::isSupportedJavaScriptMIMEType("foo/javascript"));
58
}
59
60
TEST(MIMETypeRegistry, CanShowMIMEType)
61
{
62
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("text/plain"));
63
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("text/html"));
64
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("text/xml"));
65
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("text/foo"));
66
67
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/json"));
68
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("APPLICATION/JSON"));
69
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/vnd.api+json"));
70
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("anything/something+json"));
71
72
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("text/javascript"));
73
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("TEXT/JAVASCRIPT"));
74
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/javascript"));
75
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/ecmascript"));
76
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/x-javascript"));
77
    ASSERT_TRUE(MIMETypeRegistry::canShowMIMEType("application/x-ecmascript"));
78
79
    ASSERT_FALSE(MIMETypeRegistry::canShowMIMEType("foo/bar"));
80
    ASSERT_FALSE(MIMETypeRegistry::canShowMIMEType("text/vcard"));
81
}
82
83
} // namespace TestWebKitAPI
- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm +127 lines
Line 0 a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#import "config.h"
27
28
#if WK_API_ENABLED
29
30
#import "Utilities.h"
31
#import <WebKit/WebKit.h>
32
#import <wtf/RetainPtr.h>
33
34
static bool isDone;
35
36
@interface WKNavigationResponseTestNavigationDelegate : NSObject <WKNavigationDelegate>
37
@property (nonatomic) BOOL expectation;
38
@end
39
40
@implementation WKNavigationResponseTestNavigationDelegate
41
42
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler
43
{
44
    EXPECT_EQ(navigationResponse.canShowMIMEType, self.expectation);
45
    decisionHandler(WKNavigationResponsePolicyAllow);
46
}
47
48
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation
49
{
50
    isDone = true;
51
}
52
53
@end
54
55
@interface WKNavigationResponseTestSchemeHandler : NSObject <WKURLSchemeHandler>
56
@property (nonatomic, copy) NSString *mimeType;
57
@end
58
59
@implementation WKNavigationResponseTestSchemeHandler
60
61
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
62
{
63
    RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:[NSURL URLWithString:@"test:///json-response"] MIMEType:self.mimeType expectedContentLength:1 textEncodingName:nil]);
64
    [task didReceiveResponse:response.get()];
65
    [task didReceiveData:[@"{\"data\":1234}" dataUsingEncoding:NSUTF8StringEncoding]];
66
    [task didFinish];
67
}
68
69
- (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask { }
70
71
@end
72
73
TEST(WebKit, WKNavigationResponseJSONMIMEType)
74
{
75
    isDone = false;
76
    auto schemeHandler = adoptNS([[WKNavigationResponseTestSchemeHandler alloc] init]);
77
    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
78
    [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"test"];
79
    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
80
    auto navigationDelegate = adoptNS([[WKNavigationResponseTestNavigationDelegate alloc] init]);
81
    webView.get().navigationDelegate = navigationDelegate.get();
82
83
    schemeHandler.get().mimeType = @"application/json";
84
    navigationDelegate.get().expectation = YES;
85
86
    NSURL *testURL = [NSURL URLWithString:@"test:///json-response"];
87
    [webView loadRequest:[NSURLRequest requestWithURL:testURL]];
88
    TestWebKitAPI::Util::run(&isDone);
89
}
90
91
TEST(WebKit, WKNavigationResponseJSONMIMEType2)
92
{
93
    isDone = false;
94
    auto schemeHandler = adoptNS([[WKNavigationResponseTestSchemeHandler alloc] init]);
95
    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
96
    [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"test"];
97
    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
98
    auto navigationDelegate = adoptNS([[WKNavigationResponseTestNavigationDelegate alloc] init]);
99
    webView.get().navigationDelegate = navigationDelegate.get();
100
101
    schemeHandler.get().mimeType = @"application/vnd.api+json";
102
    navigationDelegate.get().expectation = YES;
103
104
    NSURL *testURL = [NSURL URLWithString:@"test:///json-response"];
105
    [webView loadRequest:[NSURLRequest requestWithURL:testURL]];
106
    TestWebKitAPI::Util::run(&isDone);
107
}
108
109
TEST(WebKit, WKNavigationResponseUnknownMIMEType)
110
{
111
    isDone = false;
112
    auto schemeHandler = adoptNS([[WKNavigationResponseTestSchemeHandler alloc] init]);
113
    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
114
    [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"test"];
115
    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
116
    auto navigationDelegate = adoptNS([[WKNavigationResponseTestNavigationDelegate alloc] init]);
117
    webView.get().navigationDelegate = navigationDelegate.get();
118
119
    schemeHandler.get().mimeType = @"garbage/json";
120
    navigationDelegate.get().expectation = NO;
121
122
    NSURL *testURL = [NSURL URLWithString:@"test:///json-response"];
123
    [webView loadRequest:[NSURLRequest requestWithURL:testURL]];
124
    TestWebKitAPI::Util::run(&isDone);
125
}
126
127
#endif // WK_API_ENABLED

Return to Bug 176585