From 6cafcb8700fc7d4cdc4f3a9abeca12c8db310da8 Mon Sep 17 00:00:00 2001 From: "antti@apple.com" Date: Wed, 8 Feb 2012 17:35:44 +0000 Subject: [PATCH] REGRESSION (r106681): Null check missing in [WebFrame(WebInternal) _typingStyle] https://bugs.webkit.org/show_bug.cgi?id=78080 Source/WebKit/mac: Reviewed by Reviewed by Andreas Kling, Darin Adler and Dan Bernstein. * WebView/WebFrame.mm: (-[WebFrame _typingStyle]): Tools: Reviewed by Andreas Kling, Darin Adler and Dan Bernstein. Add API test. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/mac/TypingStyleCrash.mm: Added. (TestWebKitAPI): (TestWebKitAPI::TEST): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107100 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/mac/ChangeLog | 10 ++++++ Source/WebKit/mac/WebView/WebFrame.mm | 4 +-- Tools/ChangeLog | 14 ++++++++ .../TestWebKitAPI.xcodeproj/project.pbxproj | 4 +++ Tools/TestWebKitAPI/Tests/mac/TypingStyleCrash.mm | 37 ++++++++++++++++++++++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 Tools/TestWebKitAPI/Tests/mac/TypingStyleCrash.mm diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 0aeb5ad..bf11737 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,13 @@ +2012-02-07 Antti Koivisto + + REGRESSION (r106681): Null check missing in [WebFrame(WebInternal) _typingStyle] + https://bugs.webkit.org/show_bug.cgi?id=78080 + + Reviewed by Reviewed by Andreas Kling, Darin Adler and Dan Bernstein. + + * WebView/WebFrame.mm: + (-[WebFrame _typingStyle]): + 2012-02-07 Tony Chang merge DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index c09863e..9c15faf 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -791,10 +791,10 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return nil; - RefPtr typingStyle = _private->coreFrame->selection()->copyTypingStyle()->ensureCSSStyleDeclaration(); + RefPtr typingStyle = _private->coreFrame->selection()->copyTypingStyle(); if (!typingStyle) return nil; - return kit(typingStyle.get()); + return kit(typingStyle->ensureCSSStyleDeclaration()); } - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction diff --git a/Tools/ChangeLog b/Tools/ChangeLog index e2ffca7..b413b5a 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,17 @@ +2012-02-08 Antti Koivisto + + REGRESSION (r106681): Null check missing in [WebFrame(WebInternal) _typingStyle] + https://bugs.webkit.org/show_bug.cgi?id=78080 + + Reviewed by Andreas Kling, Darin Adler and Dan Bernstein. + + Add API test. + + * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: + * TestWebKitAPI/Tests/mac/TypingStyleCrash.mm: Added. + (TestWebKitAPI): + (TestWebKitAPI::TEST): + 2012-02-08 Gustavo Noronha Silva [GTK] Fails to build docs with non-standard build directories diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj index c74de7a..ea44c5e 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj @@ -117,6 +117,7 @@ C0C5D3BE14598B6F00A802A6 /* GetBackingScaleFactor.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */; }; C0C5D3C61459912900A802A6 /* GetBackingScaleFactor_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */; }; C507E8A714C6545B005D6B3B /* InspectorBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = C507E8A614C6545B005D6B3B /* InspectorBar.mm */; }; + E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */; }; F3FC3EE313678B7300126A65 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3FC3EE213678B7300126A65 /* libgtest.a */; }; F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; }; F6FDDDD314241AD4004F1729 /* PrivateBrowsingPushStateNoHistoryCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6FDDDD214241AD4004F1729 /* PrivateBrowsingPushStateNoHistoryCallback.cpp */; }; @@ -296,6 +297,7 @@ C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor.mm; sourceTree = ""; }; C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor_Bundle.mm; sourceTree = ""; }; C507E8A614C6545B005D6B3B /* InspectorBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InspectorBar.mm; sourceTree = ""; }; + E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = ""; }; F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; }; F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = ""; }; F6FDDDD214241AD4004F1729 /* PrivateBrowsingPushStateNoHistoryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrivateBrowsingPushStateNoHistoryCallback.cpp; sourceTree = ""; }; @@ -569,6 +571,7 @@ 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */, 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */, 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */, + E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */, ); path = mac; sourceTree = ""; @@ -768,6 +771,7 @@ 93F1DB5514DB1B730024C362 /* NewFirstVisuallyNonEmptyLayoutFails.cpp in Sources */, 93F7E86C14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */, BC22D31514DC689800FFB1DD /* UserMessage.cpp in Sources */, + E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/TestWebKitAPI/Tests/mac/TypingStyleCrash.mm b/Tools/TestWebKitAPI/Tests/mac/TypingStyleCrash.mm new file mode 100644 index 0000000..a23623b --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/mac/TypingStyleCrash.mm @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +namespace TestWebKitAPI { + +TEST(WebKit1, TypingStyleCrash) +{ + WebView *webView = [[WebView alloc] init]; + [webView typingStyle]; + [webView release]; +} + +} // namespace TestWebKitAPI -- 2.7.4