Source/WebKit2: Add API to get the parent frame in WKBundleFrameRef
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 19:40:22 +0000 (19:40 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 19:40:22 +0000 (19:40 +0000)
commit98f88879e82b58151ac58f511c7946aca62824a8
treecc5a1e5763d83cdf67a8c385b985aaf6e77d5325
parent67b5f0d11fd0f0b41f65139f44db017cc2cc0c7f
Source/WebKit2: Add API to get the parent frame in WKBundleFrameRef
https://bugs.webkit.org/show_bug.cgi?id=77161

Reviewed by Anders Carlsson.

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameGetParentFrame): Get the parent frame by calling WebFrame::parentFrame().
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::parentFrame): Return null if the frame does not have an owner element.
Otherwise, return the owner element's frame.
* WebProcess/WebPage/WebFrame.h:

Tools: Add test for WKBundleFrameGetParentFrame().
https://bugs.webkit.org/show_bug.cgi?id=77161

Reviewed by Anders Carlsson.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add ParentFrame.cpp and ParentFrame_Bundle.cpp.
* TestWebKitAPI/Tests/WebKit2/ParentFrame.cpp: Added.
(TestWebKitAPI):
(TestWebKitAPI::didReceiveMessageFromInjectedBundle): Get the check result from the injected bundle.
(TestWebKitAPI::setInjectedBundleClient):
(TestWebKitAPI::TEST): Load simple-iframe.html and then wait for the injected bundle to post result.
Make sure the check is successful.
* TestWebKitAPI/Tests/WebKit2/ParentFrame_Bundle.cpp: Added.
(TestWebKitAPI):
(ParentFrameTest):
(TestWebKitAPI::ParentFrameTest::ParentFrameTest):
(TestWebKitAPI::didFinishLoadForFrame): If the frame is a subframe, store it off for checking later.
If the frame is the main frame, check whether it's indeed the subframe's parent frame and post the result
to the test controller.
(TestWebKitAPI::ParentFrameTest::didCreatePage): Set the page loader client on this page.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106139 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/ParentFrame.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/ParentFrame_Bundle.cpp [new file with mode: 0644]