[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
weinig at apple.com
weinig at apple.com
Wed Dec 22 14:49:58 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c2c3e6601c21e59a742bdde2faa0ab8674eaceba
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 21 16:45:39 2010 +0000
Null frame passed when running alert from UserScript run at document start
<rdar://problem/8573809>
https://bugs.webkit.org/show_bug.cgi?id=48036
Reviewed by Adam Roben.
WebKit2:
Don't initialize a Frame until after we have notified the UIProcess of its creation.
This is necessary since arbitrary actions can happen during the call to Frame::init()
such as the running of UserScripts.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::createFrame):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createMainFrame):
(WebKit::WebFrame::createSubframe):
(WebKit::WebFrame::create):
(WebKit::WebFrame::WebFrame):
(WebKit::WebFrame::init):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
WebKitTools:
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* TestWebKitAPI/InjectedBundleController.cpp:
(TestWebKitAPI::InjectedBundleController::didReceiveMessage):
(TestWebKitAPI::InjectedBundleController::initializeTestNamed):
* TestWebKitAPI/InjectedBundleController.h:
* TestWebKitAPI/InjectedBundleTest.h:
(TestWebKitAPI::InjectedBundleTest::initialize):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp: Added.
(TestWebKitAPI::runJavaScriptAlert):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp: Added.
(TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::DocumentStartUserScriptAlertCrashTest):
(TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize):
Add test for invoking an alert during a UserScript run at document start.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70244 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5904011..6c5c903 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-10-21 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Null frame passed when running alert from UserScript run at document start
+ <rdar://problem/8573809>
+ https://bugs.webkit.org/show_bug.cgi?id=48036
+
+ Don't initialize a Frame until after we have notified the UIProcess of its creation.
+ This is necessary since arbitrary actions can happen during the call to Frame::init()
+ such as the running of UserScripts.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::createFrame):
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::createMainFrame):
+ (WebKit::WebFrame::createSubframe):
+ (WebKit::WebFrame::create):
+ (WebKit::WebFrame::WebFrame):
+ (WebKit::WebFrame::init):
+ * WebProcess/WebPage/WebFrame.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+
2010-10-21 Balazs Kelemen <kbalazs at webkit.org>
Reviewed by Andreas Kling.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index c32e5fe..01379f0 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -952,9 +952,6 @@ PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const Strin
RefPtr<WebFrame> subframe = WebFrame::createSubframe(webPage, name, ownerElement);
- // Notify the UI process that subframe has been added.
- WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCreateSubFrame(subframe->frameID()), webPage->pageID());
-
Frame* coreSubframe = subframe->coreFrame();
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.cpp b/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 15e45d0..954ec06 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -30,6 +30,7 @@
#include "InjectedBundleScriptWorld.h"
#include "WebChromeClient.h"
#include "WebPage.h"
+#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSLock.h>
@@ -74,27 +75,37 @@ static uint64_t generateListenerID()
PassRefPtr<WebFrame> WebFrame::createMainFrame(WebPage* page)
{
- return create(page, String(), 0);
+ RefPtr<WebFrame> frame = create();
+
+ WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCreateMainFrame(frame->frameID()), page->pageID());
+
+ frame->init(page, String(), 0);
+
+ return frame.release();
}
PassRefPtr<WebFrame> WebFrame::createSubframe(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement)
{
- return create(page, frameName, ownerElement);
+ RefPtr<WebFrame> frame = create();
+
+ WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCreateSubFrame(frame->frameID()), page->pageID());
+
+ frame->init(page, frameName, ownerElement);
+
+ return frame.release();
}
-PassRefPtr<WebFrame> WebFrame::create(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement)
+PassRefPtr<WebFrame> WebFrame::create()
{
- RefPtr<WebFrame> frame = adoptRef(new WebFrame(page, frameName, ownerElement));
+ RefPtr<WebFrame> frame = adoptRef(new WebFrame);
// Add explict ref() that will be balanced in WebFrameLoaderClient::frameLoaderDestroyed().
frame->ref();
- frame->coreFrame()->init();
-
return frame.release();
}
-WebFrame::WebFrame(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement)
+WebFrame::WebFrame()
: m_coreFrame(0)
, m_policyListenerID(0)
, m_policyFunction(0)
@@ -104,16 +115,6 @@ WebFrame::WebFrame(WebPage* page, const String& frameName, HTMLFrameOwnerElement
{
WebProcess::shared().addWebFrame(m_frameID, this);
- RefPtr<Frame> frame = Frame::create(page->corePage(), ownerElement, &m_frameLoaderClient);
- m_coreFrame = frame.get();
-
- frame->tree()->setName(frameName);
-
- if (ownerElement) {
- ASSERT(ownerElement->document()->frame());
- ownerElement->document()->frame()->tree()->appendChild(frame);
- }
-
#ifndef NDEBUG
webFrameCounter.increment();
#endif
@@ -128,6 +129,21 @@ WebFrame::~WebFrame()
#endif
}
+void WebFrame::init(WebPage* page, const String& frameName, HTMLFrameOwnerElement* ownerElement)
+{
+ RefPtr<Frame> frame = Frame::create(page->corePage(), ownerElement, &m_frameLoaderClient);
+ m_coreFrame = frame.get();
+
+ frame->tree()->setName(frameName);
+
+ if (ownerElement) {
+ ASSERT(ownerElement->document()->frame());
+ ownerElement->document()->frame()->tree()->appendChild(frame);
+ }
+
+ frame->init();
+}
+
WebPage* WebFrame::page() const
{
if (!m_coreFrame)
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.h b/WebKit2/WebProcess/WebPage/WebFrame.h
index f3465a1..ef1cd35 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -104,8 +104,10 @@ public:
LoadListener* loadListener() const { return m_loadListener; }
private:
- static PassRefPtr<WebFrame> create(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*);
- WebFrame(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*);
+ static PassRefPtr<WebFrame> create();
+ WebFrame();
+
+ void init(WebPage*, const String& frameName, WebCore::HTMLFrameOwnerElement*);
virtual Type type() const { return APIType; }
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 2325fad..492e270 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -129,7 +129,6 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
Settings::setMinDOMTimerInterval(0.004);
m_mainFrame = WebFrame::createMainFrame(this);
- WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCreateMainFrame(m_mainFrame->frameID()), m_pageID);
#ifndef NDEBUG
webPageCounter.increment();
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b6ade73..a394f86 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,27 @@
+2010-10-21 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Adam Roben.
+
+ Null frame passed when running alert from UserScript run at document start
+ <rdar://problem/8573809>
+ https://bugs.webkit.org/show_bug.cgi?id=48036
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/InjectedBundleController.cpp:
+ (TestWebKitAPI::InjectedBundleController::didReceiveMessage):
+ (TestWebKitAPI::InjectedBundleController::initializeTestNamed):
+ * TestWebKitAPI/InjectedBundleController.h:
+ * TestWebKitAPI/InjectedBundleTest.h:
+ (TestWebKitAPI::InjectedBundleTest::initialize):
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp: Added.
+ (TestWebKitAPI::runJavaScriptAlert):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp: Added.
+ (TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::DocumentStartUserScriptAlertCrashTest):
+ (TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize):
+ Add test for invoking an alert during a UserScript run at document start.
+
2010-10-21 Andreas Kling <kling at webkit.org>
Reviewed by Adam Roben.
@@ -127,8 +151,8 @@
Reviewed by Adam Roben.
- https://bugs.webkit.org/show_bug.cgi?id=48027
Add ability to test injected bundle API using TestWebKitAPI
+ https://bugs.webkit.org/show_bug.cgi?id=48027
* TestWebKitAPI/InjectedBundleController.cpp: Added.
* TestWebKitAPI/InjectedBundleController.h: Added.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index db2434b..f7d0fa7 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -697,7 +697,14 @@
isa = PBXProject;
buildConfigurationList = 149C29C308902C6D008A9EFC /* Build configuration list for PBXProject "DumpRenderTree" */;
compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 08FB7794FE84155DC02AAC07 /* DumpRenderTree */;
productRefGroup = 9340995508540CAF007F3BC8 /* Products */;
projectDirPath = "";
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
index dc563ac..2674801 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
@@ -81,7 +81,7 @@ void InjectedBundleController::didReceiveMessage(WKBundleRef bundle, WKStringRef
assert(WKGetTypeID(messageBody) == WKStringGetTypeID());
WKStringRef messageBodyString = static_cast<WKStringRef>(messageBody);
- self->initializeTestNamed(Util::toSTD(messageBodyString));
+ self->initializeTestNamed(bundle, Util::toSTD(messageBodyString));
return;
}
@@ -98,7 +98,7 @@ void InjectedBundleController::dumpTestNames()
printf("%s\n", (*it).first.c_str());
}
-void InjectedBundleController::initializeTestNamed(const std::string& identifier)
+void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std::string& identifier)
{
CreateInjectedBundleTestFunction createTestFunction = m_createInjectedBundleTestFunctions[identifier];
if (!createTestFunction) {
@@ -107,7 +107,7 @@ void InjectedBundleController::initializeTestNamed(const std::string& identifier
}
m_currentTest = createTestFunction(identifier);
- m_currentTest->initialize();
+ m_currentTest->initialize(bundle);
}
void InjectedBundleController::registerCreateInjectedBundleTestFunction(const std::string& identifier, CreateInjectedBundleTestFunction function)
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.h b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
index 89e2c5e..8b45fff 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.h
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
@@ -41,7 +41,7 @@ public:
void initialize(WKBundleRef);
void dumpTestNames();
- void initializeTestNamed(const std::string&);
+ void initializeTestNamed(WKBundleRef bundle, const std::string&);
typedef InjectedBundleTest* (*CreateInjectedBundleTestFunction)(const std::string&);
void registerCreateInjectedBundleTestFunction(const std::string&, CreateInjectedBundleTestFunction);
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
index f3812ef..b0224f2 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
@@ -34,7 +34,7 @@ class InjectedBundleTest {
public:
virtual ~InjectedBundleTest() { }
- virtual void initialize() { }
+ virtual void initialize(WKBundleRef) { }
virtual void didCreatePage(WKBundleRef, WKBundlePageRef) { }
virtual void willDestroyPage(WKBundleRef, WKBundlePageRef) { }
diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index fa967b7..0e2fd23 100644
--- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -30,6 +30,8 @@
BC90995E12567BC100083756 /* WKString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90995D12567BC100083756 /* WKString.cpp */; };
BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9099931256ACF100083756 /* WKStringJSString.cpp */; };
BCA61DB511700EFD00460D1E /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCA61DB411700EFD00460D1E /* WebKit2.framework */; };
+ BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */; };
+ BCB68042126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */; };
BCB9E9F111235BDE00A137E0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCB9E9F011235BDE00A137E0 /* Cocoa.framework */; };
BCBD3710125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */; };
BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = BCBD372E125ABBE600D2C29F /* icon.png */; };
@@ -45,7 +47,7 @@
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = BC57597F126E74AF006F0F12 /* InjectedBundle */;
+ remoteGlobalIDString = BC57597F126E74AF006F0F12;
remoteInfo = InjectedBundle;
};
/* End PBXContainerItemProxy section */
@@ -107,6 +109,8 @@
BC90995D12567BC100083756 /* WKString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKString.cpp; sourceTree = "<group>"; };
BC9099931256ACF100083756 /* WKStringJSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKStringJSString.cpp; sourceTree = "<group>"; };
BCA61DB411700EFD00460D1E /* WebKit2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStartUserScriptAlertCrash.cpp; sourceTree = "<group>"; };
+ BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStartUserScriptAlertCrash_Bundle.cpp; sourceTree = "<group>"; };
BCB9E7C711234E3A00A137E0 /* TestsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestsController.h; sourceTree = "<group>"; };
BCB9E7FA112359A300A137E0 /* Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test.h; sourceTree = "<group>"; };
BCB9E9F011235BDE00A137E0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
@@ -229,6 +233,8 @@
BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
+ BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
+ BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
);
path = WebKit2;
sourceTree = "<group>";
@@ -366,6 +372,7 @@
C02B77F2126612140026BF0F /* SpacebarScrolling.cpp in Sources */,
BC575AAD126E83B9006F0F12 /* InjectedBundleBasic.cpp in Sources */,
BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */,
+ BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -378,6 +385,7 @@
BC575AB0126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp in Sources */,
BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */,
BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */,
+ BCB68042126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
new file mode 100644
index 0000000..5e0655e
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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/WebKit2.h>
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo)
+{
+ TEST_ASSERT(frame);
+ TEST_ASSERT(WKFrameGetPage(frame) == page);
+ TEST_ASSERT(WKStringIsEqualToUTF8CString(alertText, "an alert"));
+
+ done = true;
+}
+
+TEST(WebKit2, DocumentStartUserScriptAlertCrashTest)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest"));
+ WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
+ PlatformWebView webView(pageNamespace.get());
+
+ WKPageUIClient uiClient;
+ memset(&uiClient, 0, sizeof(uiClient));
+ uiClient.version = 0;
+ uiClient.clientInfo = 0;
+ uiClient.runJavaScriptAlert = runJavaScriptAlert;
+ WKPageSetPageUIClient(webView.page(), &uiClient);
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
new file mode 100644
index 0000000..a96bef2
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
@@ -0,0 +1,50 @@
+/*
+ * 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 "InjectedBundleTest.h"
+#include <WebKit2/WebKit2.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+class DocumentStartUserScriptAlertCrashTest : public InjectedBundleTest {
+public:
+ DocumentStartUserScriptAlertCrashTest(const std::string& identifier)
+ : InjectedBundleTest(identifier)
+ {
+ }
+
+ virtual void initialize(WKBundleRef bundle)
+ {
+ WKRetainPtr<WKStringRef> source(AdoptWK, WKStringCreateWithUTF8CString("alert('an alert');"));
+ WKBundleAddUserScript(bundle, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+ }
+};
+
+static InjectedBundleTest::Register<DocumentStartUserScriptAlertCrashTest> registrar("DocumentStartUserScriptAlertCrashTest");
+
+} // namespace TestWebKitAPI
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list