Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index dd36331e7f040ac47d3788312c9e4266b133d4f7..14f55f42e3e9c03311e5ee0ad71d151e44fa6306 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -98,6 +98,7 @@ |
#include "public/web/WebTextCheckingResult.h" |
#include "public/web/WebViewClient.h" |
#include "web/WebLocalFrameImpl.h" |
+#include "web/WebRemoteFrameImpl.h" |
#include "web/WebViewImpl.h" |
#include "web/tests/FrameTestHelpers.h" |
#include "wtf/Forward.h" |
@@ -185,7 +186,8 @@ protected: |
webViewHelper->initializeAndLoad(m_baseURL + "nodeimage.html"); |
webViewHelper->webView()->resize(WebSize(640, 480)); |
webViewHelper->webView()->layout(); |
- RefPtr<LocalFrame> frame = toLocalFrame(webViewHelper->webViewImpl()->page()->mainFrame()); |
+ RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper->webViewImpl()->page()->mainFrame()); |
+ ASSERT(frame); |
Element* element = frame->document()->getElementById(testcase.c_str()); |
return frame->nodeImage(*element); |
} |
@@ -641,7 +643,7 @@ TEST_F(WebFrameTest, PostMessageThenDetach) |
FrameTestHelpers::WebViewHelper webViewHelper; |
webViewHelper.initializeAndLoad("about:blank"); |
- RefPtr<LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()); |
+ RefPtrWillBeRawPtr<LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()); |
NonThrowableExceptionState exceptionState; |
frame->domWindow()->postMessage(SerializedScriptValue::create("message"), 0, "*", frame->domWindow(), exceptionState); |
webViewHelper.reset(); |
@@ -3484,8 +3486,8 @@ TEST_F(WebFrameTest, FindOnDetachedFrame) |
WebFindOptions options; |
WebString searchText = WebString::fromUTF8(kFindString); |
WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); |
- RefPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext(false)); |
- RefPtr<LocalFrame> holdSecondFrame = secondFrame->frame(); |
+ RefPtrWillBeRawPtr<WebLocalFrameImpl> secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext(false)); |
+ RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
// Detach the frame before finding. |
EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
@@ -3503,8 +3505,6 @@ TEST_F(WebFrameTest, FindOnDetachedFrame) |
runPendingTasks(); |
EXPECT_TRUE(client.findResultsAreReady()); |
- |
- holdSecondFrame.release(); |
} |
TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings) |
@@ -3526,7 +3526,7 @@ TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings) |
WebString searchText = WebString::fromUTF8(kFindString); |
WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); |
WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext(false)); |
- RefPtr<LocalFrame> holdSecondFrame = secondFrame->frame(); |
+ RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0)); |
@@ -3544,8 +3544,6 @@ TEST_F(WebFrameTest, FindDetachFrameBeforeScopeStrings) |
runPendingTasks(); |
EXPECT_TRUE(client.findResultsAreReady()); |
- |
- holdSecondFrame.release(); |
} |
TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings) |
@@ -3567,7 +3565,7 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings) |
WebString searchText = WebString::fromUTF8(kFindString); |
WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()); |
WebLocalFrameImpl* secondFrame = toWebLocalFrameImpl(mainFrame->traverseNext(false)); |
- RefPtr<LocalFrame> holdSecondFrame = secondFrame->frame(); |
+ RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) |
EXPECT_TRUE(frame->find(kFindIdentifier, searchText, options, false, 0)); |
@@ -3585,8 +3583,6 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings) |
runPendingTasks(); |
EXPECT_TRUE(client.findResultsAreReady()); |
- |
- holdSecondFrame.release(); |
} |
TEST_F(WebFrameTest, ResetMatchCount) |
@@ -5340,7 +5336,7 @@ TEST_F(WebFrameTest, ReloadIframe) |
webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, &mainClient); |
WebLocalFrameImpl* mainFrame = webViewHelper.webViewImpl()->mainFrameImpl(); |
- RefPtr<WebLocalFrameImpl> childFrame = toWebLocalFrameImpl(mainFrame->firstChild()); |
+ RefPtrWillBeRawPtr<WebLocalFrameImpl> childFrame = toWebLocalFrameImpl(mainFrame->firstChild()); |
ASSERT_EQ(childFrame->client(), &childClient); |
EXPECT_EQ(mainClient.childFrameCreationCount(), 1); |
EXPECT_EQ(childClient.willSendRequestCallCount(), 1); |
@@ -6034,6 +6030,8 @@ void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* par |
TEST_F(WebFrameSwapTest, SwapFirstChild) |
{ |
WebFrame* remoteFrame = WebRemoteFrame::create(0); |
+ // FIXME: Oilpan: add a guard/protector-like helper type that tidies this up. |
+ RefPtrWillBePersistent<WebRemoteFrameImpl> protect(toWebRemoteFrameImpl(remoteFrame)); |
swapAndVerifyFirstChildConsistency("local->remote", mainFrame(), remoteFrame); |
FrameTestHelpers::TestWebFrameClient client; |
@@ -6071,6 +6069,7 @@ void swapAndVerifyMiddleChildConsistency(const char* const message, WebFrame* pa |
TEST_F(WebFrameSwapTest, SwapMiddleChild) |
{ |
WebFrame* remoteFrame = WebRemoteFrame::create(0); |
+ RefPtrWillBePersistent<WebRemoteFrameImpl> protect(toWebRemoteFrameImpl(remoteFrame)); |
swapAndVerifyMiddleChildConsistency("local->remote", mainFrame(), remoteFrame); |
FrameTestHelpers::TestWebFrameClient client; |
@@ -6105,6 +6104,7 @@ void swapAndVerifyLastChildConsistency(const char* const message, WebFrame* pare |
TEST_F(WebFrameSwapTest, SwapLastChild) |
{ |
WebFrame* remoteFrame = WebRemoteFrame::create(0); |
+ RefPtrWillBePersistent<WebRemoteFrameImpl> protect(toWebRemoteFrameImpl(remoteFrame)); |
swapAndVerifyLastChildConsistency("local->remote", mainFrame(), remoteFrame); |
FrameTestHelpers::TestWebFrameClient client; |
@@ -6139,6 +6139,7 @@ void swapAndVerifySubframeConsistency(const char* const message, WebFrame* oldFr |
TEST_F(WebFrameSwapTest, SwapParentShouldDetachChildren) |
{ |
WebRemoteFrame* remoteFrame = WebRemoteFrame::create(0); |
+ RefPtrWillBePersistent<WebRemoteFrameImpl> protect(toWebRemoteFrameImpl(remoteFrame)); |
WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); |
EXPECT_TRUE(targetFrame); |
swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); |
@@ -6193,7 +6194,7 @@ TEST_F(WebFrameTest, LoaderOriginAccess) |
KURL resourceUrl(ParsedURLString, "chrome://test.pdf"); |
registerMockedChromeURLLoad("test.pdf"); |
- RefPtr<LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame()); |
+ RefPtrWillBeRawPtr<LocalFrame> frame(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())); |
MockDocumentThreadableLoaderClient client; |
ThreadableLoaderOptions options; |