[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
bweinstein at apple.com
bweinstein at apple.com
Wed Dec 22 15:02:05 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5cdf917f13aaea290af47d2073c92334d52df357
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 27 16:56:02 2010 +0000
WebKit2 shouldn't try to send an empty user agent
https://bugs.webkit.org/show_bug.cgi?id=48397
Reviewed by Adam Roben.
WebKit2:
Change the check of the custom user agent to an empty check instead of a null check. When the client application
sets a custom user agent and then resets it, the custom user agent is set to an empty string. If all we do
is check for a null string, then we will think we have a custom user agent (which is empty) and send an empty
user agent.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::userAgent):
WebKitTools:
Add a test that when we set our custom user agent to an empty string, we don't send
an empty user agent.
* TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp: Added.
(TestWebKitAPI::didRunJavaScript): Make sure that the result of navigator.userAgent isn't empty.
(TestWebKitAPI::TEST): Set our custom user agent to the empty string, and run navigator.userAgent.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add the new file.
* TestWebKitAPI/win/TestWebKitAPI.vcproj: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70658 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index fed7d48..3f626a2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-26 Brian Weinstein <bweinstein at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2 shouldn't try to send an empty user agent
+ https://bugs.webkit.org/show_bug.cgi?id=48397
+
+ Change the check of the custom user agent to an empty check instead of a null check. When the client application
+ sets a custom user agent and then resets it, the custom user agent is set to an empty string. If all we do
+ is check for a null string, then we will think we have a custom user agent (which is empty) and send an empty
+ user agent.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::userAgent):
+
2010-10-27 Adam Roben <aroben at apple.com>
Don't call NPP_GetValue if the plugin didn't provide an implementation
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 7242293..9421a8c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -664,7 +664,7 @@ void WebPage::setCustomUserAgent(const String& customUserAgent)
String WebPage::userAgent() const
{
- if (!m_customUserAgent.isNull())
+ if (!m_customUserAgent.isEmpty())
return m_customUserAgent;
// FIXME: This should be based on an application name.
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 5e0c005..779f838 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-26 Brian Weinstein <bweinstein at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2 shouldn't try to send an empty user agent
+ https://bugs.webkit.org/show_bug.cgi?id=48397
+
+ Add a test that when we set our custom user agent to an empty string, we don't send
+ an empty user agent.
+
+ * TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp: Added.
+ (TestWebKitAPI::didRunJavaScript): Make sure that the result of navigator.userAgent isn't empty.
+ (TestWebKitAPI::TEST): Set our custom user agent to the empty string, and run navigator.userAgent.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add the new file.
+ * TestWebKitAPI/win/TestWebKitAPI.vcproj: Ditto.
+
2010-10-27 Adam Roben <aroben at apple.com>
Check in file I forgot in r70653
diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index 75ac253..dd216a5 100644
--- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -10,6 +10,7 @@
1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; };
1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */; };
+ 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; };
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
BC131A9B1171316900B69727 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131A9A1171316900B69727 /* main.mm */; };
BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC131AA8117131FC00B69727 /* TestsController.cpp */; };
@@ -83,6 +84,7 @@
1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvaluateJavaScript.cpp; sourceTree = "<group>"; };
+ 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
BC131883117114A800B69727 /* PlatformUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformUtilities.h; sourceTree = "<group>"; };
BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformUtilitiesMac.mm; sourceTree = "<group>"; };
@@ -230,6 +232,7 @@
BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */,
BC909779125571AB00083756 /* PageLoadBasic.cpp */,
+ 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */,
C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
BC90995D12567BC100083756 /* WKString.cpp */,
BC9099931256ACF100083756 /* WKStringJSString.cpp */,
@@ -377,6 +380,7 @@
BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */,
BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */,
+ 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
new file mode 100644
index 0000000..af3ed12
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 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 "Test.h"
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WebKit2.h>
+
+namespace TestWebKitAPI {
+
+static bool testDone;
+
+static void didRunJavaScript(WKStringRef resultString, WKErrorRef error, void* context)
+{
+ TEST_ASSERT(context == reinterpret_cast<void*>(0x1234578));
+
+ // Make sure that the result of navigator.userAgent isn't empty, even if we set the custom
+ // user agent to the empty string.
+ TEST_ASSERT(!WKStringIsEmpty(resultString));
+
+ testDone = true;
+}
+
+TEST(WebKit2, PreventEmptyUserAgent)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+ WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
+ PlatformWebView webView(pageNamespace.get());
+
+ WKPageSetCustomUserAgent(webView.page(), WKStringCreateWithUTF8CString(""));
+ WKRetainPtr<WKStringRef> javaScriptString(AdoptWK, WKStringCreateWithUTF8CString("navigator.userAgent"));
+ WKPageRunJavaScriptInMainFrame(webView.page(), javaScriptString.get(), reinterpret_cast<void*>(0x1234578), didRunJavaScript);
+
+ Util::run(&testDone);
+}
+
+} // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
index d1c4f0f..2e7bbe4 100644
--- a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
+++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
@@ -449,6 +449,10 @@
>
</File>
<File
+ RelativePath="..\Tests\WebKit2\PreventEmptyUserAgent.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\WebKit2\simple.html"
>
</File>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list