diff options
Diffstat (limited to 'WebKitTools')
54 files changed, 2077 insertions, 421 deletions
diff --git a/WebKitTools/BuildSlaveSupport/build.webkit.org-config/config.json b/WebKitTools/BuildSlaveSupport/build.webkit.org-config/config.json index 93f1c11..f4b0822 100644 --- a/WebKitTools/BuildSlaveSupport/build.webkit.org-config/config.json +++ b/WebKitTools/BuildSlaveSupport/build.webkit.org-config/config.json @@ -35,12 +35,12 @@ { "name": "szeged-windows-1", "platform": "qt"}, { "name": "szeged-windows-2", "platform": "qt"}, - { "name": "google-windows-1", "platform": "chromium" }, - { "name": "google-mac-1", "platform": "chromium" }, - { "name": "google-linux-1", "platform": "chromium" }, - { "name": "google-windows-2", "platform": "chromium" }, - { "name": "google-mac-2", "platform": "chromium" }, - { "name": "google-linux-2", "platform": "chromium" }, + { "name": "google-windows-1", "platform": "chromium-win" }, + { "name": "google-mac-1", "platform": "chromium-mac" }, + { "name": "google-linux-1", "platform": "chromium-linux" }, + { "name": "google-windows-2", "platform": "chromium-win" }, + { "name": "google-mac-2", "platform": "chromium-mac" }, + { "name": "google-linux-2", "platform": "chromium-linux" }, { "name": "google-new-tests", "platform": "mac-leopard" } ], @@ -150,32 +150,32 @@ }, { "name": "Chromium Win Release", "type": "Build", "builddir": "chromium-win-release", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-win", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-windows-1"] }, { "name": "Chromium Mac Release", "type": "Build", "builddir": "chromium-mac-release", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-mac", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-mac-1"] }, { "name": "Chromium Linux Release", "type": "Build", "builddir": "chromium-linux-release", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-linux", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-linux-1"] }, { "name": "Chromium Win Release (Tests)", "type": "NewBuildAndTest", "builddir": "chromium-win-release-tests", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-win", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-windows-2"] }, { "name": "Chromium Mac Release (Tests)", "type": "NewBuildAndTest", "builddir": "chromium-mac-release-tests", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-mac", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-mac-2"] }, { "name": "Chromium Linux Release (Tests)", "type": "NewBuildAndTest", "builddir": "chromium-linux-release-tests", - "platform": "chromium", "configuration": "release", "architectures": ["i386"], + "platform": "chromium-linux", "configuration": "release", "architectures": ["i386"], "slavenames": ["google-linux-2"] }, { diff --git a/WebKitTools/BuildSlaveSupport/build.webkit.org-config/master.cfg b/WebKitTools/BuildSlaveSupport/build.webkit.org-config/master.cfg index e1eaa71..5ff4681 100644 --- a/WebKitTools/BuildSlaveSupport/build.webkit.org-config/master.cfg +++ b/WebKitTools/BuildSlaveSupport/build.webkit.org-config/master.cfg @@ -68,6 +68,13 @@ class InstallChromiumDependencies(shell.ShellCommand): command = ["perl", "./WebKitTools/Scripts/update-webkit-chromium", "--force"] haltOnFailure = True +class CleanupChromiumLinuxCrashLogs(shell.ShellCommand): + name = "cleanup crash logs" + description = ["removing crash logs"] + descriptionDone = ["removed crash logs"] + command = ["sh", "-c", "rm -rf /tmp/.org.chromium.*"] + haltOnFailure = False + def appendCustomBuildFlags(step, platform): if platform in ('gtk', 'wx', 'qt', 'chromium'): @@ -343,7 +350,7 @@ class Factory(factory.BuildFactory): if platform == "win": self.addStep(KillOldProcesses) self.addStep(InstallWin32Dependencies) - if platform == "chromium": + if platform.startswith("chromium"): self.addStep(InstallChromiumDependencies) class BuildFactory(Factory): @@ -375,8 +382,10 @@ class BuildAndTestFactory(Factory): TestClass = RunWebKitTests def __init__(self, platform, configuration, architectures): Factory.__init__(self, platform, configuration, architectures, False) + if platform == "chromium-linux": + self.addStep(CleanupChromiumLinuxCrashLogs) self.addStep(CompileWebKit) - if platform != "chromium": + if not platform.startswith("chromium"): self.addStep(RunJavaScriptCoreTests) self.addStep(self.TestClass) # Tiger's Python 2.3 is too old. WebKit Python requires 2.5+. diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog index 1423d88..7aa3128 100644 --- a/WebKitTools/ChangeLog +++ b/WebKitTools/ChangeLog @@ -1,3 +1,705 @@ +2010-07-28 Kenichi Ishibashi <bashi@google.com> + + Reviewed by Shinichiro Hamaji. + + Fixed <https://bugs.webkit.org/show_bug.cgi?id=33814> + check-webkit-style gives false positives in single-line functions. + + * Scripts/webkitpy/style/checkers/cpp.py: + * Scripts/webkitpy/style/checkers/cpp_unittest.py: + +2010-07-28 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.execCommand + <https://bugs.webkit.org/show_bug.cgi?id=42538> + + WebKitTestRunner needs layoutTestController.isCommandEnabled + <https://bugs.webkit.org/show_bug.cgi?id=42671> + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added execCommand and isCommandEnabled. + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::execCommand): Added. + (WTR::LayoutTestController::isCommandEnabled): Added. + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Ditto. + +2010-07-28 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + [DRT/Chromium] Introduce drt_expectations.txt for NRWT + https://bugs.webkit.org/show_bug.cgi?id=43123 + + Introduce LayoutTests/platform/chromium/drt_expectations.txt, + which overrides test expectations only for DumpRenderTree, in + order to manage what problems are investigated. + This change will be reverted when we switch to DRT completely. + + * Scripts/webkitpy/layout_tests/port/chromium.py: + Add drt_expectations.txt content to the result of + test_expectations_overrides() if --use-drt is specified. + +2010-07-28 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler. + + First pass at visited link support for WK2 + https://bugs.webkit.org/show_bug.cgi?id=43157 + + * MiniBrowser/mac/AppDelegate.m: + (didNavigateWithNavigationData): + (didPerformClientRedirect): + (didPerformServerRedirect): + (didUpdateHistoryTitle): + (populateVisitedLinks): Added for the new version of the HistoryClient. + (-[BrowserAppDelegate init]): Set the HistoryClient right after creating the context(s) + + * MiniBrowser/mac/BrowserWindowController.m: + (-[BrowserWindowController awakeFromNib]): + +2010-07-28 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Add DOM bindings support for wx port. + + * DumpRenderTree/wscript: + * wx/browser/wscript: + * wx/build/settings.py: + +2010-07-28 Tony Chang <tony@chromium.org> + + Reviewed by Kent Tamura. + + [chromium] cleanup temp files left by Linux DRT + https://bugs.webkit.org/show_bug.cgi?id=43062 + + * BuildSlaveSupport/build.webkit.org-config/config.json: Rename the chromium bots to include the OS + * BuildSlaveSupport/build.webkit.org-config/master.cfg: add a step on chromium-linux to delete temp files left + by crashed DRTs + +2010-07-28 Antonio Gomes <tonikitoo@webkit.org> + + Rubber-stamped by Kenneth Christiansen. + + More Developer menu items reordering. + + Grouping related menu items together, visually and logically (in the code). + + No behavior change. + + * QtTestBrowser/main.cpp: + (LauncherWindow::createChrome): + +2010-07-27 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Ojan Vafai. + + Add FILE_SYSTEM build flag for FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=42915 + + * Scripts/build-webkit: + +2010-07-27 Martin Robinson <mrobinson@igalia.com> + + Reviewed by David Levin. + + Stylebot should not complain about NULL usage in calls to gdk_pixbuf_save_to + https://bugs.webkit.org/show_bug.cgi?id=43090 + + * Scripts/webkitpy/style/checkers/cpp.py: Add exemption for some GdkPixbuf methods. + * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added some tests for this behavior. + +2010-07-27 Kent Tamura <tkent@chromium.org> + + Unreviewed, trivial typo fix. + + * Scripts/webkitpy/layout_tests/port/chromium.py: + Fix a wrong method name committed by r64109. + +2010-07-27 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=43087 + Clean up handling of strings at the WebKit2 API layer. + + * MiniBrowser/mac/BrowserWindowController.m: + (runJavaScriptAlert): + (runJavaScriptConfirm): + (runJavaScriptPrompt): + (didNavigateWithNavigationData): + (-[BrowserWindowController updateProvisionalURLForFrame:]): + * MiniBrowser/mac/WebBundle/WebBundleMain.m: + (_didClearWindowForFrame): + +2010-07-27 Ojan Vafai <ojan@chromium.org> + + Reviewed by Eric Seidel. + + webkit-patch post-commits is broken: AttributeError: Values instance has no attribute 'no_squash' + https://bugs.webkit.org/show_bug.cgi?id=42984 + + squash and no_squash have been intentionally erroring for a couple weeks now. + But post-commits was just broken. Just remove squash/no_squash. + + * Scripts/webkitpy/tool/steps/abstractstep.py: + * Scripts/webkitpy/tool/steps/options.py: + +2010-07-27 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after introduction of EXECUTABLE_ALLOCATOR_DEMAND. + + * wx/build/settings.py: + +2010-07-27 Adam Roben <aroben@apple.com> + + Mac build fix + + * MiniBrowser/mac/BrowserWindowController.m: + (processDidExit): + (-[BrowserWindowController awakeFromNib]): + Added processDidExit support. + +2010-07-26 Antonio Gomes <tonikitoo@webkit.org> + + Rubber-stamped by Simon Hausmann. + + [Qt] Reorder some items in Developers' menu so QGraphicsView one is easier accessible. + + Move some less useful menu items on Developers menu from the top to the bottom, so + QGraphicsView menu goes to the top, and becomes more quickly accessible. + + * QtTestBrowser/main.cpp: + (LauncherWindow::createChrome): + +2010-07-26 Adam Roben <aroben@apple.com> + + Fix the path to InjectedBundle.dll in Debug_Internal builds + + Fixes <http://webkit.org/b/42994> WebKitTestRunner fails to load + InjectedBundle.dll in the Debug_Internal configuration + + Reviewed by Anders Carlsson. + + * WebKitTestRunner/win/TestControllerWin.cpp: + (WTR::TestController::initializeInjectedBundlePath): Add the _debug + suffix only in Debug_All builds. + +2010-07-25 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=42947 + Check for WEBKIT_TESTFONTS for qt, gtk and windows port and throw + error. Without which dumpRenderTree crashes. + + * Scripts/old-run-webkit-tests: + +2010-07-27 Kent Tamura <tkent@chromium.org> + + Reviewed by Dimitri Glazkov. + + https://bugs.webkit.org/show_bug.cgi?id=42956 + [DRT/Chromium] Fix "out of sync" assertion error + + Fix an assertion error on Windows like the following: + 100721 20:16:46 chromium.py:386 CRITICAL Test got out of sync: + |file:///c:/WebKitBuildSlave2/chromium-win-release-tests/build/LayoutTests/http/tests/local/blob/send-data-blob.html| + |file:///C:/WebKitBuildSlave2/chromium-win-release-tests/build/LayoutTests/http/tests/local/blob/send-data-blob.html| + + * Scripts/webkitpy/layout_tests/port/chromium.py: + If the url matches with "file:///[a-z]:", does case-ignore comparison. + GURL capitalize the driver letter of a file: URL. + +2010-07-26 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.counterValueForElementById + https://bugs.webkit.org/show_bug.cgi?id=42537 + + WebKitTestRunner needs layoutTestController.markerTextForListItem + https://bugs.webkit.org/show_bug.cgi?id=42549 + + * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm: + Fixed _paramterExpression typo. Improved support for string type as a + return value, so we don't try to include DOMString.h and we can convert + the string to a JSValue by calling JSValueMakeStringOrNull. + + * WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h: + Added JSValueMakeStringOrNull, used by the code generator. + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added counterValueForElementById and markerTextForListItem. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + Moved constant to the top of the file. + (WTR::toCF): Added. Converts strings to CFStringRef. + (WTR::toWK): Added. Converts strings to WKStringRef. + (WTR::toJS): Added. Converts strings to JSStringRef. + (WTR::setProperty): Moved this function to the top of the file + rather than having it down where it's used inside the class. Also + renamed it so it's a separate function rather than an overload of + JSObjectSetProperty. + (WTR::propertyValue): Copied this here from InjectedBundlePage.cpp. + Should move it somewhere we can share it. + (WTR::propertyObject): Ditto. + (WTR::getElementById): Added. Calls getElementById through the magic + of JavaScript. + (WTR::LayoutTestController::pauseAnimationAtTimeOnElementWithId): + Chagned to use toWK instead of four local variables. + (WTR::LayoutTestController::counterValueForElementById): Added. + Calls WKBundleFrameCopyCounterValue. + (WTR::LayoutTestController::markerTextForListItem): Added. + Calls WKBundleFrameCopyMarkerText. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + Added counterValueForElementById and markerTextForListItem. + +2010-07-26 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] The EventSender should support simulating drop events + https://bugs.webkit.org/show_bug.cgi?id=39844 + + Add initial dropping support to the GTK+ EventSender. + + * DumpRenderTree/gtk/DumpRenderTree.cpp: + (createWebView): Listen for some new drag-and-drop signals. + * DumpRenderTree/gtk/EventSender.cpp: Add currentDragSourceContext. + (dispatchEvent): + Detect situations where a drag is either starting or ending and massage + GTK+ into sending the appropriate signals to the WebView. + (replaySavedEvents): Remove comment. + (makeEventSender): Clear the currentDragSourceContext when creating a new EventSender. + (dragBeginCallback): Capture the new currentDragSourceContext when a drag begins. + (dragEndCallback): Clear the currentDragSourceContext when a drag ends. + (dragFailedCallback): Disable the GTK+ drag failed animation. + * DumpRenderTree/gtk/EventSender.h: Add declarations for new signal callbacks. + +2010-07-26 Daniel Bates <dbates@rim.com> + + Reviewed by Darin Adler. + + svn-unapply warns of uninitialized variable when unapplying + a patch that describes an svn move operation + https://bugs.webkit.org/show_bug.cgi?id=42036 + + Fixes Perl uninitialized variable warnings when un-applying + a patch that moves a file. + + * Scripts/svn-unapply: + - Modified patch() so that it initializes $patch to the empty + string when we don't have svnConvertedText (such as when + reversing a diff that represents a svn copy/move operation). + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Move some non-APIish functions into private headers. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + +2010-07-26 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=42986 + Add prompt and confirm client functions to WebKit2 + + * MiniBrowser/mac/BrowserWindowController.m: + (-[BrowserWindowController awakeFromNib]): + +2010-07-26 Adam Roben <aroben@apple.com> + + Windows build fix + + * MiniBrowser/MiniBrowser.vcproj: + * WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj: + Removed empty attributes so the values will be picked up from the + vsprops files. (Also removed a couple of attributes that accidentally + duplicated values from the vsprops files.) + +2010-07-26 Brian Weinstein <bweinstein@apple.com> + + Rubber-stamped by Adam Roben. + + Touch MiniBrowser's stdafx to fix the build. + + * MiniBrowser/win/stdafx.h: + +2010-07-26 Hayato Ito <hayato@chromium.org> + + Reviewed by Shinichiro Hamaji. + + Add pretty printer of WTF::Vector for GDB 7. + + https://bugs.webkit.org/show_bug.cgi?id=40909 + + * gdb/wtf.py: Added. + +2010-07-26 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix feature detection regexp + + We were missing the last feature + + * Scripts/webkitdirs.pm: + +2010-07-25 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + WebKitTestRunner needs to support layoutTestController.dumpSelectionRect + https://bugs.webkit.org/show_bug.cgi?id=42326 + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added dumpSelectionRect. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + (WTR::LayoutTestController::dumpSelectionRect): Added. For now, this + does nothing because its purpose is to change pixel test output and + we do not have pixel tests implemented yet. + +2010-07-25 Darin Adler <darin@apple.com> + + Reviewed by Maciej Stachowiak. + + WebKitTestRunner needs to support layoutTestController.keepWebHistory + https://bugs.webkit.org/show_bug.cgi?id=42323 + + Added keepWebHistory and computedStyleIncludingVisitedInfo. + + Also fixed misspellings of the word "receive". + + Also tweaked the names of some of the LayoutTestController members. + + * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm: + Added support for a type named "object" that is passed and returns as + a JSValueRef. + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added keepWebHistory and computedStyleIncludingVisitedInfo. Also + put setAcceptsEditing up nearer the top. + + * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: + (WTR::InjectedBundle::_didReceiveMessage): Fixed mispellings of receive. + (WTR::InjectedBundle::initialize): Ditto. + (WTR::InjectedBundle::didReceiveMessage): Ditto. + (WTR::InjectedBundle::reset): Reset the state of visited links between + tests. Also eliminated the unused argument to the LayoutTestController + create function. + (WTR::InjectedBundle::setShouldTrackVisitedLinks): Added. + * WebKitTestRunner/InjectedBundle/InjectedBundle.h: Ditto. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::shouldBeginEditing): Call shouldAllowEditing + instead of acceptsEditing. + (WTR::InjectedBundlePage::shouldEndEditing): Ditto. + (WTR::InjectedBundlePage::shouldInsertNode): Ditto. + (WTR::InjectedBundlePage::shouldInsertText): Ditto. + (WTR::InjectedBundlePage::shouldDeleteRange): Ditto. + (WTR::InjectedBundlePage::shouldChangeSelectedRange): Ditto. + (WTR::InjectedBundlePage::shouldApplyStyle): Ditto. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::create): Removed uneeded argument. + (WTR::LayoutTestController::LayoutTestController): Removed unneeded + argument. Updated for rename of m_acceptsEditing to m_shouldAllowEditing. + (WTR::LayoutTestController::numberOfActiveAnimations): Added some FIXMEs + about the fact that this works on the main frame. + (WTR::LayoutTestController::pauseAnimationAtTimeOnElementWithId): Ditto. + (WTR::LayoutTestController::keepWebHistory): Added. + (WTR::LayoutTestController::computedStyleIncludingVisitedInfo): Added. + (WTR::JSObjectSetProperty): Added. Helper to make the function below + cleaner. + (WTR::LayoutTestController::makeWindowObject): Changed to use the + overload of JSObjectSetProperty above. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Changes to + match above. + + * WebKitTestRunner/TestController.cpp: + (WTR::TestController::initialize): Fixed mispellings of receive. + (WTR::TestController::_didReceiveMessageFromInjectedBundle): Ditto. + (WTR::TestController::didReceiveMessageFromInjectedBundle): Ditto. + * WebKitTestRunner/TestController.h: Ditto. + * WebKitTestRunner/TestInvocation.cpp: + (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Ditto. + * WebKitTestRunner/TestInvocation.h: Ditto. + +2010-07-25 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=42193 + Support layoutTestController.dumpEditingDelegates in WebKitTestRunner + + Step 2 - add the rest of editing delegates. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::operator<<): Fixed to not crash when range is null. + (WTR::InjectedBundlePage::InjectedBundlePage): + (WTR::InjectedBundlePage::_shouldEndEditing): + (WTR::InjectedBundlePage::_shouldInsertNode): + (WTR::InjectedBundlePage::_shouldInsertText): + (WTR::InjectedBundlePage::_shouldDeleteRange): + (WTR::InjectedBundlePage::_shouldChangeSelectedRange): + (WTR::InjectedBundlePage::_shouldApplyStyle): + (WTR::InjectedBundlePage::_didBeginEditing): + (WTR::InjectedBundlePage::_didEndEditing): + (WTR::InjectedBundlePage::_didChange): + (WTR::InjectedBundlePage::_didChangeSelection): + (WTR::InjectedBundlePage::shouldEndEditing): + (WTR::InjectedBundlePage::shouldInsertNode): + (WTR::InjectedBundlePage::shouldInsertText): + (WTR::InjectedBundlePage::shouldDeleteRange): + (WTR::InjectedBundlePage::shouldChangeSelectedRange): + (WTR::InjectedBundlePage::shouldApplyStyle): + (WTR::InjectedBundlePage::didBeginEditing): + (WTR::InjectedBundlePage::didEndEditing): + (WTR::InjectedBundlePage::didChange): + (WTR::InjectedBundlePage::didChangeSelection): + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: + +2010-07-24 Chris Fleizach <cfleizach@apple.com> + + Reviewed by David Kilzer. + + AX: need a layout test testing misspelled words in attributed strings + https://bugs.webkit.org/show_bug.cgi?id=42899 + + * DumpRenderTree/AccessibilityUIElement.cpp: + (attributedStringForRangeCallback): + (attributedStringRangeIsMisspelledCallback): + (AccessibilityUIElement::getJSClass): + * DumpRenderTree/AccessibilityUIElement.h: + * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp: + (AccessibilityUIElement::attributedStringForRange): + (AccessibilityUIElement::attributedStringRangeIsMisspelled): + * DumpRenderTree/mac/AccessibilityUIElementMac.mm: + (AccessibilityUIElement::attributedStringForRange): + (AccessibilityUIElement::attributedStringRangeIsMisspelled): + * DumpRenderTree/win/AccessibilityUIElementWin.cpp: + (AccessibilityUIElement::attributedStringForRange): + (AccessibilityUIElement::attributedStringRangeIsMisspelled): + +2010-07-23 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/42911> Update ruby tools to work with shallow framework bundles + + Reviewed by Mark Rowe. + + * Scripts/check-for-inappropriate-files-in-framework: Added + check for the SHALLOW_BUNDLE environment variable so that the + script will work with iOS WebKit builds. + * Scripts/check-for-webkit-framework-include-consistency: Ditto. + +2010-07-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Eliminate unneeded WKBundleFrameCopyInnerText function from WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42847 + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::operator<<): Replaced the WKStringToUTF8 function with + a set of overloaded stream operators. + (WTR::dumpPath): Changed to use ostringstream and return a string. + (WTR::propertyValue): Added. + (WTR::propertyObject): Added. + (WTR::propertyString): Added. + (WTR::numericWindowPropertyValue): Changed to call propertyValue. + (WTR::dumpFrameScrollPosition): Removed now unneeded WKStringToUTF8 sequence + since we now have suitable streaming functions. + (WTR::dumpFrameText): Use propertyObject and propertyString instead of + WKBundleFrameCopyInnerText. + (WTR::dumpDescendantFramesText): Removed now unneeded WKStringToUTF8 sequence + since we now have suitable streaming functions. + (WTR::InjectedBundlePage::dump): Ditto. + (WTR::InjectedBundlePage::willAddMessageToConsole): Ditto. + (WTR::InjectedBundlePage::willSetStatusbarText): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptAlert): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptConfirm): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto. + +2010-07-22 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Sam Weinig and Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=42193 + Support layoutTestController.dumpEditingDelegates in WebKitTestRunner + + Step 1: Add the method, and implement one actual delegate call as proof of concept. No tests + fixed, but this makes difference one line smaller on many editing tests. + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added dumpEditingCallbacks() and setAcceptsEditing(). + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::dumpPath): Dump path to a node in a format that's compatible with DumpRenderTree. + (WTR::operator<<): Print a range. + (WTR::InjectedBundlePage::InjectedBundlePage): Set editor client in addition to existing + clients. + (WTR::InjectedBundlePage::_shouldBeginEditing): The only client method implemented so far. + (WTR::InjectedBundlePage::shouldBeginEditing): Ditto. + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added a section for editor client + calls. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::LayoutTestController): + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: + (WTR::LayoutTestController::dumpEditingCallbacks): + (WTR::LayoutTestController::setAcceptsEditing): + (WTR::LayoutTestController::acceptsEditing): + (WTR::LayoutTestController::shouldDumpEditingCallbacks): + Store m_acceptsEditing and m_dumpEditingCallbacks. + +2010-07-22 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] QtWebKit needs public API for Notifications. + https://bugs.webkit.org/show_bug.cgi?id=41413 + + Update DumpRenderTree and QtTestBrowser to use the new API. + Add new DRT API to flag that notifications permission requests should be ignored. + + * DumpRenderTree/qt/DumpRenderTreeQt.cpp: + (WebCore::WebPage::WebPage): + (WebCore::WebPage::requestPermission): + (WebCore::WebPage::checkPermission): + (WebCore::WebPage::cancelRequestsForPermission): + * DumpRenderTree/qt/DumpRenderTreeQt.h: + * DumpRenderTree/qt/LayoutTestControllerQt.cpp: + (LayoutTestController::reset): + (LayoutTestController::ignoreDesktopNotificationPermissionRequests): + (LayoutTestController::checkDesktopNotificationPermission): + * DumpRenderTree/qt/LayoutTestControllerQt.h: + (LayoutTestController::ignoreReqestForPermission): + * QtTestBrowser/main.cpp: + (LauncherWindow::LauncherWindow): + * QtTestBrowser/webpage.cpp: + (WebPage::WebPage): + (WebPage::requestPermission): + (WebPage::checkPermission): + (WebPage::cancelRequestsForPermission): + * QtTestBrowser/webpage.h: + +2010-07-22 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support layoutTestController.dumpChildFramesAsText + https://bugs.webkit.org/show_bug.cgi?id=42325 + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + Added dumpChildFramesAsText. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::dumpFrameText): Added. + (WTR::dumpDescendantFramesText): Added. + (WTR::InjectedBundlePage::dumpAllFramesText): Added. + (WTR::InjectedBundlePage::dump): Changed to use the new whatToDump function + instead of the shouldDumpAsText function, and added a case for AllFramesText. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Added dumpAllFramesText. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::LayoutTestController): Replaced m_dumpAsText with + m_whatToDump. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Added + dumpChildFramesAsText. Removed shouldDumpAsText, shouldDumpDOMAsWebArchive, + and shouldDumpSourceAsWebArchive. Added whatToDump. + +2010-07-22 Adam Roben <aroben@apple.com> + + Windows build fix + + Inspired by r63881. + + * MiniBrowser/MiniBrowser.vcproj: + * WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj: + Removed pre- and post-build events so they will be inherited from the + vsprops files. + +2010-07-21 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions + https://bugs.webkit.org/show_bug.cgi?id=42548 + + * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::numericWindowPropertyValue): Renamed this and moved it up higher in the file. + (WTR::dumpFrameScrollPosition): Added argument telling whether to dump the frame name. + Changed to a file-internal function instead of a member function. + (WTR::dumpDescendantFrameScrollPositions): Added. + (WTR::InjectedBundlePage::dumpAllFrameScrollPositions): Added. + (WTR::InjectedBundlePage::dump): Changed to call dumpAllFrameScrollPositions when + appropriate. Also streamlined all the WKStringToUTF8 call sites. + (WTR::InjectedBundlePage::willAddMessageToConsole): Streamlined use of WKStringToUTF8. + (WTR::InjectedBundlePage::willSetStatusbarText): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptAlert): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptConfirm): Ditto. + (WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Updated for above changes. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::LayoutTestController): Initialize + m_shouldDumpAllFrameScrollPositions. + (WTR::LayoutTestController::shouldDumpMainFrameScrollPosition): Renamed from + shouldDumpFrameScrollPositions. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Reorganized the file a + bit, added dumpChildFrameScrollPositions and shouldDumpAllFrameScrollPositions, + and renamed shouldDumpFrameScrollPositions to shouldDumpMainFrameScrollPosition. + +2010-07-21 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + WebKitTestRunner needs to support dumping of scroll position + https://bugs.webkit.org/show_bug.cgi?id=42514 + + * MiniBrowser/mac/WebBundle/WebBundleMain.m: + (_didClearWindowForFrame): Use JSGlobalContextRef instead of JSContextRef. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: + (WTR::InjectedBundlePage::_didClearWindowForFrame): Use JSGlobalContextRef + instead of JSContextRef. + (WTR::InjectedBundlePage::dump): Call dumpFrameScrollPosition when appropriate. + (WTR::numericWindowProperty): Added. Helper for dumpFrameScrollPosition. + (WTR::InjectedBundlePage::dumpFrameScrollPosition): Added. + (WTR::InjectedBundlePage::didClearWindowForFrame): Use JSGlobalContextRef + instead of JSContextRef. + + * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Removed names from + arguments that simply repeat the argument type. Added dumpFrameScrollPosition. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: + (WTR::LayoutTestController::shouldDumpDOMAsWebArchive): Added. Currently + returns false. + (WTR::LayoutTestController::shouldDumpSourceAsWebArchive): Added. Currently + returns false. + (WTR::LayoutTestController::shouldDumpFrameScrollPositions): Added. Matches + the logic in DumpRenderTree. + + * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Updated for above changes. + + * WebKitTestRunner/WebKitTestRunner.xcodeproj: Added property svn:ignore. + 2010-07-21 Kevin Ollivier <kevino@theolliviers.com> [wx] Build fix, adding the WebCore/bindings/generic dir to the list of build dirs. diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp index c4d5e6f..e09eb35 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp @@ -152,6 +152,29 @@ static JSValueRef stringForRangeCallback(JSContextRef context, JSObjectRef funct return JSValueMakeString(context, stringDescription.get()); } +static JSValueRef attributedStringForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + unsigned location = UINT_MAX, length = 0; + if (argumentCount == 2) { + location = JSValueToNumber(context, arguments[0], exception); + length = JSValueToNumber(context, arguments[1], exception); + } + + JSRetainPtr<JSStringRef> stringDescription(Adopt, toAXElement(thisObject)->attributedStringForRange(location, length)); + return JSValueMakeString(context, stringDescription.get()); +} + +static JSValueRef attributedStringRangeIsMisspelledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + unsigned location = UINT_MAX, length = 0; + if (argumentCount == 2) { + location = JSValueToNumber(context, arguments[0], exception); + length = JSValueToNumber(context, arguments[1], exception); + } + + return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length)); +} + static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount != 1) @@ -711,6 +734,8 @@ JSClassRef AccessibilityUIElement::getJSClass() { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "indexOfChild", indexOfChildCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h index 2a06962..13415cd 100644 --- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h +++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h @@ -177,6 +177,8 @@ public: JSStringRef boundsForRange(unsigned location, unsigned length); void setSelectedTextRange(unsigned location, unsigned length); JSStringRef stringForRange(unsigned location, unsigned length); + JSStringRef attributedStringForRange(unsigned location, unsigned length); + bool attributedStringRangeIsMisspelled(unsigned location, unsigned length); // Table-specific AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row); diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp index fbdbd23..a09ad2a 100644 --- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp @@ -499,6 +499,18 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) return JSStringCreateWithCharacters(0, 0); } +JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) +{ + // FIXME: implement + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) +{ + // FIXME: implement + return false; +} + AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) { // FIXME: implement diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp index 2812224..bd9c0c9 100644 --- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp @@ -886,6 +886,10 @@ static WebKitWebView* createWebView() "signal::document-load-finished", webViewDocumentLoadFinished, 0, "signal::geolocation-policy-decision-requested", geolocationPolicyDecisionRequested, 0, "signal::onload-event", webViewOnloadEvent, 0, + "signal::drag-begin", dragBeginCallback, 0, + "signal::drag-end", dragEndCallback, 0, + "signal::drag-failed", dragFailedCallback, 0, + NULL); g_signal_connect(view, diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp index 4936fe5..b95fec2 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp @@ -45,8 +45,6 @@ #include <gdk/gdkkeysyms.h> #include <string.h> -// FIXME: Implement support for synthesizing drop events. - extern "C" { extern void webkit_web_frame_layout(WebKitWebFrame* frame); } @@ -62,6 +60,7 @@ static int lastClickTimeOffset; static int lastClickButton; static int buttonCurrentlyDown; static int clickCount; +GdkDragContext* currentDragSourceContext; struct DelayedMessage { GdkEvent event; @@ -359,13 +358,36 @@ static void dispatchEvent(GdkEvent event) return; gtk_main_do_event(&event); + + if (!currentDragSourceContext) + return; + + if (event.type == GDK_MOTION_NOTIFY) { + // WebKit has called gtk_drag_start(), but because the main loop isn't + // running GDK internals don't know that the drag has started yet. Pump + // the main loop a little bit so that GDK is in the correct state. + while (gtk_events_pending()) + gtk_main_iteration(); + + // Simulate a drag motion on the top-level GDK window. + GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view)); + GdkWindow* parentWidgetWindow = parentWidget->window; + gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND, + event.motion.x_root, event.motion.y_root, + currentDragSourceContext->action, currentDragSourceContext->actions, GDK_CURRENT_TIME); + + } else if (currentDragSourceContext && event.type == GDK_BUTTON_RELEASE) { + // We've released the mouse button, we should just be able to spin the + // event loop here and have GTK+ send the appropriate notifications for + // the end of the drag. + while (gtk_events_pending()) + gtk_main_iteration(); + } + } void replaySavedEvents() { - // FIXME: Eventually we may need to have more sophisticated logic to - // track drag-and-drop operations. - // First send all the events that are ready to be sent while (startOfQueue < endOfQueue) { if (msgQueue[startOfQueue].delay) { @@ -631,7 +653,26 @@ JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame) endOfQueue = 0; startOfQueue = 0; + + currentDragSourceContext = 0; } return JSObjectMake(context, getClass(context), 0); } + +void dragBeginCallback(GtkWidget*, GdkDragContext* context, gpointer) +{ + currentDragSourceContext = context; +} + +void dragEndCallback(GtkWidget*, GdkDragContext* context, gpointer) +{ + currentDragSourceContext = 0; +} + +gboolean dragFailedCallback(GtkWidget*, GdkDragContext* context, gpointer) +{ + // Return TRUE here to disable the stupid GTK+ drag failed animation, + // which introduces asynchronous behavior into our drags. + return TRUE; +} diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.h b/WebKitTools/DumpRenderTree/gtk/EventSender.h index ce33ccc..e9b758d 100644 --- a/WebKitTools/DumpRenderTree/gtk/EventSender.h +++ b/WebKitTools/DumpRenderTree/gtk/EventSender.h @@ -32,8 +32,15 @@ typedef const struct OpaqueJSContext* JSContextRef; typedef struct OpaqueJSValue* JSObjectRef; +typedef struct _GtkWidget GtkWidget; +typedef struct _GdkDragContext GdkDragContext; +typedef void* gpointer; +typedef int gboolean; JSObjectRef makeEventSender(JSContextRef context, bool isTopFrame); void replaySavedEvents(); +void dragBeginCallback(GtkWidget*, GdkDragContext*, gpointer); +void dragEndCallback(GtkWidget*, GdkDragContext*, gpointer); +gboolean dragFailedCallback(GtkWidget*, GdkDragContext*, gpointer); #endif diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm index ba0631d..d1592b2 100644 --- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm +++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm @@ -855,6 +855,37 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned location, unsigned l return 0; } +JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length) +{ + NSRange range = NSMakeRange(location, length); + BEGIN_AX_OBJC_EXCEPTIONS + NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; + if (![string isKindOfClass:[NSAttributedString class]]) + return 0; + + NSString* stringWithAttrs = [string description]; + return [stringWithAttrs createJSStringRef]; + END_AX_OBJC_EXCEPTIONS + + return 0; +} + +bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length) +{ + NSRange range = NSMakeRange(location, length); + BEGIN_AX_OBJC_EXCEPTIONS + NSAttributedString* string = [m_element accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute forParameter:[NSValue valueWithRange:range]]; + if (![string isKindOfClass:[NSAttributedString class]]) + return false; + + NSDictionary* attrs = [string attributesAtIndex:0 effectiveRange:nil]; + if([[attrs objectForKey:NSAccessibilityMisspelledTextAttribute] boolValue]) + return true; + END_AX_OBJC_EXCEPTIONS + + return false; +} + JSStringRef AccessibilityUIElement::attributesOfColumnHeaders() { // not yet defined in AppKit... odd diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 022a867..c6c39b5 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -130,16 +130,6 @@ public: }; #endif -void checkPermissionCallback(QObject* receiver, const QUrl& url, NotificationPermission& permission) -{ - qobject_cast<DumpRenderTree*>(receiver)->checkPermission(url, permission); -} - -void requestPermissionCallback(QObject* receiver, const QString& origin) -{ - qobject_cast<DumpRenderTree*>(receiver)->requestPermission(origin); -} - WebPage::WebPage(QObject* parent, DumpRenderTree* drt) : QWebPage(parent) , m_webInspector(0) @@ -167,10 +157,9 @@ WebPage::WebPage(QObject* parent, DumpRenderTree* drt) setNetworkAccessManager(m_drt->networkAccessManager()); setPluginFactory(new TestPlugin(this)); - DumpRenderTreeSupportQt::setNotificationsReceiver(m_drt); - DumpRenderTreeSupportQt::setCheckPermissionFunction(checkPermissionCallback); - DumpRenderTreeSupportQt::setRequestPermissionFunction(requestPermissionCallback); - + connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); + connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&))); + connect(this, SIGNAL(cancelRequestsForPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain))); } WebPage::~WebPage() @@ -228,6 +217,36 @@ void WebPage::javaScriptAlert(QWebFrame*, const QString& message) fprintf(stdout, "ALERT: %s\n", message.toUtf8().constData()); } +void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain) +{ + switch (domain) { + case NotificationsPermissionDomain: + if (!m_drt->layoutTestController()->ignoreReqestForPermission()) + setUserPermission(frame, domain, PermissionGranted); + break; + default: + break; + } +} + +void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy) +{ + switch (domain) { + case NotificationsPermissionDomain: + { + QUrl url = frame->url(); + policy = m_drt->layoutTestController()->checkDesktopNotificationPermission(url.scheme() + "://" + url.host()) ? PermissionGranted : PermissionDenied; + break; + } + default: + break; + } +} + +void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain) +{ +} + static QString urlSuitableForTestResult(const QString& url) { if (url.isEmpty() || !url.startsWith(QLatin1String("file://"))) @@ -992,16 +1011,6 @@ void DumpRenderTree::switchFocus(bool focused) } -void DumpRenderTree::checkPermission(const QUrl& url, NotificationPermission& permission) -{ - permission = m_controller->checkDesktopNotificationPermission(url.scheme() + "://" + url.host()) ? NotificationAllowed : NotificationDenied; -} - -void DumpRenderTree::requestPermission(const QString& origin) -{ - DumpRenderTreeSupportQt::allowNotificationForOrigin(origin); -} - #if defined(Q_WS_X11) void DumpRenderTree::initializeFonts() { diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index f258189..de0c6c5 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -119,8 +119,6 @@ public Q_SLOTS: void dumpDatabaseQuota(QWebFrame* frame, const QString& dbName); void statusBarMessage(const QString& message); void windowCloseRequested(); - void checkPermission(const QUrl&, NotificationPermission&); - void requestPermission(const QString&); Q_SIGNALS: void quit(); @@ -193,6 +191,9 @@ public: public slots: bool shouldInterruptJavaScript() { return false; } bool allowGeolocationRequest(QWebFrame *frame); + void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); + void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); + void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); protected: bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type); diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 3a6229f..8ebdbae 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -67,6 +67,7 @@ void LayoutTestController::reset() m_globalFlag = false; m_userStyleSheetEnabled = false; m_desktopNotificationAllowedOrigins.clear(); + m_ignoreDesktopNotification = false; DumpRenderTreeSupportQt::dumpEditingCallbacks(false); DumpRenderTreeSupportQt::dumpFrameLoader(false); @@ -193,9 +194,14 @@ void LayoutTestController::grantDesktopNotificationPermission(const QString& ori m_desktopNotificationAllowedOrigins.append(origin); } +void LayoutTestController::ignoreDesktopNotificationPermissionRequests() +{ + m_ignoreDesktopNotification = true; +} + bool LayoutTestController::checkDesktopNotificationPermission(const QString& origin) { - return m_desktopNotificationAllowedOrigins.contains(origin); + return !m_ignoreDesktopNotification && m_desktopNotificationAllowedOrigins.contains(origin); } void LayoutTestController::display() diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index 4e95381..4ebf99d 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -70,6 +70,7 @@ public: bool canOpenWindows() const { return m_canOpenWindows; } bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } bool waitForPolicy() const { return m_waitForPolicy; } + bool ignoreReqestForPermission() const { return m_ignoreDesktopNotification; } void reset(); @@ -120,6 +121,7 @@ public slots: void setCloseRemainingWindowsWhenComplete(bool = false) {} int windowCount(); void grantDesktopNotificationPermission(const QString& origin); + void ignoreDesktopNotificationPermissionRequests(); bool checkDesktopNotificationPermission(const QString& origin); void display(); void clearBackForwardList(); @@ -252,6 +254,7 @@ private: WebCore::DumpRenderTree* m_drt; QWebHistory* m_webHistory; QStringList m_desktopNotificationAllowedOrigins; + bool m_ignoreDesktopNotification; }; #endif // LayoutTestControllerQt_h diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp index 6aef32e..8c2fea2 100644 --- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp @@ -450,6 +450,16 @@ JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) return JSStringCreateWithCharacters(0, 0); } +JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) +{ + return JSStringCreateWithCharacters(0, 0); +} + +bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) +{ + return false; +} + AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row) { return 0; diff --git a/WebKitTools/DumpRenderTree/wscript b/WebKitTools/DumpRenderTree/wscript index 5e6c597..75d208f 100644 --- a/WebKitTools/DumpRenderTree/wscript +++ b/WebKitTools/DumpRenderTree/wscript @@ -33,6 +33,7 @@ include_paths = [ os.path.join(output_dir), os.path.join(wk_root, 'JavaScriptCore'), os.path.join(wk_root, 'WebCore'), + os.path.join(wk_root, 'WebCore', 'bindings', 'wx'), os.path.join(wk_root, 'WebKit', 'wx'), '.', 'wx' diff --git a/WebKitTools/Makefile b/WebKitTools/Makefile index c1f1991..57ea097 100644 --- a/WebKitTools/Makefile +++ b/WebKitTools/Makefile @@ -1,4 +1,4 @@ -MODULES = DumpRenderTree MiniBrowser +MODULES = DumpRenderTree WebKitTestRunner MiniBrowser all: @for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \ diff --git a/WebKitTools/MiniBrowser/MiniBrowser.vcproj b/WebKitTools/MiniBrowser/MiniBrowser.vcproj index 43fc34f..3ae3f60 100644 --- a/WebKitTools/MiniBrowser/MiniBrowser.vcproj +++ b/WebKitTools/MiniBrowser/MiniBrowser.vcproj @@ -24,7 +24,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -40,14 +39,12 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
@@ -60,8 +57,6 @@ />
<Tool
Name="VCManifestTool"
- TypeLibraryFile=""
- ComponentFileName=""
/>
<Tool
Name="VCXDCMakeTool"
@@ -80,7 +75,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -93,7 +87,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -109,14 +102,12 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
@@ -147,7 +138,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -159,7 +149,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -175,14 +164,12 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
@@ -195,8 +182,6 @@ />
<Tool
Name="VCManifestTool"
- TypeLibraryFile=""
- ComponentFileName=""
/>
<Tool
Name="VCXDCMakeTool"
@@ -215,7 +200,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -227,7 +211,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -243,14 +226,12 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
@@ -263,8 +244,6 @@ />
<Tool
Name="VCManifestTool"
- TypeLibraryFile=""
- ComponentFileName=""
/>
<Tool
Name="VCXDCMakeTool"
@@ -283,7 +262,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
</Configurations>
diff --git a/WebKitTools/MiniBrowser/mac/AppDelegate.m b/WebKitTools/MiniBrowser/mac/AppDelegate.m index 2805157..ccbf176 100644 --- a/WebKitTools/MiniBrowser/mac/AppDelegate.m +++ b/WebKitTools/MiniBrowser/mac/AppDelegate.m @@ -28,8 +28,9 @@ #import "BrowserWindowController.h" #import "BrowserStatisticsWindowController.h" -#import <WebKit2/WKStringCF.h> #import <WebKit2/WKContextPrivate.h> +#import <WebKit2/WKStringCF.h> +#import <WebKit2/WKURLCF.h> static NSString *defaultURL = @"http://www.webkit.org/"; @@ -46,6 +47,55 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess WKStringRelease(newMessage); } +#pragma mark History Client Callbacks + +static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo) +{ + WKStringRef wkTitle = WKNavigationDataCopyTitle(navigationData); + CFStringRef title = WKStringCopyCFString(0, wkTitle); + WKStringRelease(wkTitle); + + WKURLRef wkURL = WKNavigationDataCopyURL(navigationData); + CFURLRef url = WKURLCopyCFURL(0, wkURL); + WKURLRelease(wkURL); + + LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url); + CFRelease(title); + CFRelease(url); +} + +static void didPerformClientRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) +{ + CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); + CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); + LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); + CFRelease(cfSourceURL); + CFRelease(cfDestinationURL); +} + +static void didPerformServerRedirect(WKContextRef context, WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) +{ + CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); + CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); + LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); + CFRelease(cfSourceURL); + CFRelease(cfDestinationURL); +} + +static void didUpdateHistoryTitle(WKContextRef context, WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo) +{ + CFStringRef cfTitle = WKStringCopyCFString(0, title); + CFURLRef cfURL = WKURLCopyCFURL(0, URL); + LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL); + CFRelease(cfTitle); + CFRelease(cfURL); +} + +static void populateVisitedLinks(WKContextRef context, const void *clientInfo) +{ + LOG(@"HistoryClient - populateVisitedLinks"); +} + - (id)init { self = [super init]; @@ -56,6 +106,17 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess currentProcessModel = kProcessModelSharedSecondaryProcess; WKContextRef threadContext = WKContextGetSharedThreadContext(); + WKContextHistoryClient historyClient = { + 0, + self, + didNavigateWithNavigationData, + didPerformClientRedirect, + didPerformServerRedirect, + didUpdateHistoryTitle, + populateVisitedLinks + }; + WKContextSetHistoryClient(threadContext, &historyClient); + threadPageNamespace = WKPageNamespaceCreate(threadContext); WKContextRelease(threadContext); @@ -70,6 +131,7 @@ void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef mess _didRecieveMessageFromInjectedBundle }; WKContextSetInjectedBundleClient(processContext, &bundleClient); + WKContextSetHistoryClient(processContext, &historyClient); processPageNamespace = WKPageNamespaceCreate(processContext); WKContextRelease(processContext); diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m index 234c04c..9a987d2 100644 --- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m +++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m @@ -152,105 +152,110 @@ #pragma mark Loader Client Callbacks -static void _didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { [(BrowserWindowController *)clientInfo didStartProvisionalLoadForFrame:frame]; } -static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { [(BrowserWindowController *)clientInfo didReceiveServerRedirectForProvisionalLoadForFrame:frame]; } -static void _didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { [(BrowserWindowController *)clientInfo didFailProvisionalLoadWithErrorForFrame:frame]; } -static void _didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { [(BrowserWindowController *)clientInfo didCommitLoadForFrame:frame]; } -static void _didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { LOG(@"didFinishLoadForFrame"); } -static void _didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { [(BrowserWindowController *)clientInfo didFailLoadWithErrorForFrame:frame]; } -static void _didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, const void *clientInfo) +static void didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, const void *clientInfo) { CFStringRef cfTitle = WKStringCopyCFString(0, title); LOG(@"didReceiveTitleForFrame \"%@\"", (NSString *)cfTitle); CFRelease(cfTitle); } -static void _didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didFirstLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { LOG(@"didFirstLayoutForFrame"); } -static void _didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) +static void didFirstVisuallyNonEmptyLayoutForFrame(WKPageRef page, WKFrameRef frame, const void *clientInfo) { LOG(@"didFirstVisuallyNonEmptyLayoutForFrame"); } -static void _didStartProgress(WKPageRef page, const void *clientInfo) +static void didStartProgress(WKPageRef page, const void *clientInfo) { [(BrowserWindowController *)clientInfo didStartProgress]; } -static void _didChangeProgress(WKPageRef page, const void *clientInfo) +static void didChangeProgress(WKPageRef page, const void *clientInfo) { [(BrowserWindowController *)clientInfo didChangeProgress:WKPageGetEstimatedProgress(page)]; } -static void _didFinishProgress(WKPageRef page, const void *clientInfo) +static void didFinishProgress(WKPageRef page, const void *clientInfo) { [(BrowserWindowController *)clientInfo didFinishProgress]; } -static void _didBecomeUnresponsive(WKPageRef page, const void *clientInfo) +static void didBecomeUnresponsive(WKPageRef page, const void *clientInfo) { LOG(@"didBecomeUnresponsive"); } -static void _didBecomeResponsive(WKPageRef page, const void *clientInfo) +static void didBecomeResponsive(WKPageRef page, const void *clientInfo) { LOG(@"didBecomeResponsive"); } -static void _didChangeBackForwardList(WKPageRef page, const void *clientInfo) +static void processDidExit(WKPageRef page, const void *clientInfo) +{ + LOG(@"processDidExit"); +} + +static void didChangeBackForwardList(WKPageRef page, const void *clientInfo) { [(BrowserWindowController *)clientInfo validateToolbar]; } #pragma mark Policy Client Callbacks -static void _decidePolicyForNavigationAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) +static void decidePolicyForNavigationAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) { LOG(@"decidePolicyForNavigationAction"); WKFramePolicyListenerUse(listener); } -static void _decidePolicyForNewWindowAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) +static void decidePolicyForNewWindowAction(WKPageRef page, WKFrameNavigationType navigationType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) { LOG(@"decidePolicyForNewWindowAction"); WKFramePolicyListenerUse(listener); } -static void _decidePolicyForMIMEType(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) +static void decidePolicyForMIMEType(WKPageRef page, WKStringRef MIMEType, WKURLRef url, WKFrameRef frame, WKFramePolicyListenerRef listener, const void *clientInfo) { WKFramePolicyListenerUse(listener); } #pragma mark UI Client Callbacks -static WKPageRef _createNewPage(WKPageRef page, const void* clientInfo) +static WKPageRef createNewPage(WKPageRef page, const void* clientInfo) { LOG(@"createNewPage"); BrowserWindowController *controller = [[BrowserWindowController alloc] initWithPageNamespace:WKPageGetPageNamespace(page)]; @@ -259,13 +264,13 @@ static WKPageRef _createNewPage(WKPageRef page, const void* clientInfo) return controller->_webView.pageRef; } -static void _showPage(WKPageRef page, const void *clientInfo) +static void showPage(WKPageRef page, const void *clientInfo) { LOG(@"showPage"); [[(BrowserWindowController *)clientInfo window] orderFront:nil]; } -static void _closePage(WKPageRef page, const void *clientInfo) +static void closePage(WKPageRef page, const void *clientInfo) { LOG(@"closePage"); WKPageClose(page); @@ -273,17 +278,20 @@ static void _closePage(WKPageRef page, const void *clientInfo) WKPageRelease(page); } -static void _runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef frame, const void* clientInfo) +static void runJavaScriptAlert(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo) { NSAlert* alert = [[NSAlert alloc] init]; - CFURLRef cfURL = WKURLCopyCFURL(0, WKFrameGetURL(frame)); - [alert setMessageText:[NSString stringWithFormat:@"JavaScript Alert from %@.", [(NSURL *)cfURL absoluteString]]]; + WKURLRef wkURL = WKFrameCopyURL(frame); + CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); + WKURLRelease(wkURL); + + [alert setMessageText:[NSString stringWithFormat:@"JavaScript alert dialog from %@.", [(NSURL *)cfURL absoluteString]]]; CFRelease(cfURL); - CFStringRef cfAlertText = WKStringCopyCFString(0, alertText); - [alert setInformativeText:(NSString *)alertText]; - CFRelease(cfAlertText); + CFStringRef cfMessage = WKStringCopyCFString(0, message); + [alert setInformativeText:(NSString *)cfMessage]; + CFRelease(cfMessage); [alert addButtonWithTitle:@"OK"]; @@ -291,43 +299,68 @@ static void _runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRe [alert release]; } +static bool runJavaScriptConfirm(WKPageRef page, WKStringRef message, WKFrameRef frame, const void* clientInfo) +{ + NSAlert* alert = [[NSAlert alloc] init]; -#pragma mark History Client Callbacks + WKURLRef wkURL = WKFrameCopyURL(frame); + CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); + WKURLRelease(wkURL); -static void _didNavigateWithNavigationData(WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo) -{ - CFStringRef title = WKStringCopyCFString(0, WKNavigationDataGetTitle(navigationData)); - CFURLRef url = WKURLCopyCFURL(0, WKNavigationDataGetURL(navigationData)); - LOG(@"HistoryClient - didNavigateWithNavigationData - title: %@ - url: %@", title, url); - CFRelease(title); - CFRelease(url); -} + [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [(NSURL *)cfURL absoluteString]]]; + CFRelease(cfURL); -static void _didPerformClientRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) -{ - CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); - CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); - LOG(@"HistoryClient - didPerformClientRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); - CFRelease(cfSourceURL); - CFRelease(cfDestinationURL); -} + CFStringRef cfMessage = WKStringCopyCFString(0, message); + [alert setInformativeText:(NSString *)cfMessage]; + CFRelease(cfMessage); -static void _didPerformServerRedirect(WKPageRef page, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void *clientInfo) -{ - CFURLRef cfSourceURL = WKURLCopyCFURL(0, sourceURL); - CFURLRef cfDestinationURL = WKURLCopyCFURL(0, destinationURL); - LOG(@"HistoryClient - didPerformServerRedirect - sourceURL: %@ - destinationURL: %@", cfSourceURL, cfDestinationURL); - CFRelease(cfSourceURL); - CFRelease(cfDestinationURL); + [alert addButtonWithTitle:@"OK"]; + [alert addButtonWithTitle:@"Cancel"]; + + NSInteger button = [alert runModal]; + [alert release]; + + return button == NSAlertFirstButtonReturn; } -static void _didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void *clientInfo) +static WKStringRef runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void* clientInfo) { - CFStringRef cfTitle = WKStringCopyCFString(0, title); - CFURLRef cfURL = WKURLCopyCFURL(0, URL); - LOG(@"HistoryClient - didUpdateHistoryTitle - title: %@ - URL: %@", cfTitle, cfURL); - CFRelease(cfTitle); + NSAlert* alert = [[NSAlert alloc] init]; + + WKURLRef wkURL = WKFrameCopyURL(frame); + CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); + WKURLRelease(wkURL); + + [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [(NSURL *)cfURL absoluteString]]]; CFRelease(cfURL); + + CFStringRef cfMessage = WKStringCopyCFString(0, message); + [alert setInformativeText:(NSString *)cfMessage]; + CFRelease(cfMessage); + + [alert addButtonWithTitle:@"OK"]; + [alert addButtonWithTitle:@"Cancel"]; + + NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)]; + CFStringRef cfDefaultValue = WKStringCopyCFString(0, defaultValue); + [input setStringValue:(NSString *)cfDefaultValue]; + CFRelease(cfDefaultValue); + + [alert setAccessoryView:input]; + + NSInteger button = [alert runModal]; + + NSString* result = nil; + if (button == NSAlertFirstButtonReturn) { + [input validateEditing]; + result = [input stringValue]; + } + + [alert release]; + + if (!result) + return 0; + return WKStringCreateWithCFString((CFStringRef)result); } - (void)awakeFromNib @@ -342,53 +375,45 @@ static void _didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef U WKPageLoaderClient loadClient = { 0, /* version */ self, /* clientInfo */ - _didStartProvisionalLoadForFrame, - _didReceiveServerRedirectForProvisionalLoadForFrame, - _didFailProvisionalLoadWithErrorForFrame, - _didCommitLoadForFrame, - _didFinishLoadForFrame, - _didFailLoadWithErrorForFrame, - _didReceiveTitleForFrame, - _didFirstLayoutForFrame, - _didFirstVisuallyNonEmptyLayoutForFrame, - _didStartProgress, - _didChangeProgress, - _didFinishProgress, - _didBecomeUnresponsive, - _didBecomeResponsive, - _didChangeBackForwardList + didStartProvisionalLoadForFrame, + didReceiveServerRedirectForProvisionalLoadForFrame, + didFailProvisionalLoadWithErrorForFrame, + didCommitLoadForFrame, + didFinishLoadForFrame, + didFailLoadWithErrorForFrame, + didReceiveTitleForFrame, + didFirstLayoutForFrame, + didFirstVisuallyNonEmptyLayoutForFrame, + didStartProgress, + didChangeProgress, + didFinishProgress, + didBecomeUnresponsive, + didBecomeResponsive, + processDidExit, + didChangeBackForwardList }; WKPageSetPageLoaderClient(_webView.pageRef, &loadClient); WKPagePolicyClient policyClient = { 0, /* version */ self, /* clientInfo */ - _decidePolicyForNavigationAction, - _decidePolicyForNewWindowAction, - _decidePolicyForMIMEType + decidePolicyForNavigationAction, + decidePolicyForNewWindowAction, + decidePolicyForMIMEType }; WKPageSetPagePolicyClient(_webView.pageRef, &policyClient); WKPageUIClient uiClient = { 0, /* version */ self, /* clientInfo */ - _createNewPage, - _showPage, - _closePage, - _runJavaScriptAlert + createNewPage, + showPage, + closePage, + runJavaScriptAlert, + runJavaScriptConfirm, + runJavaScriptPrompt }; WKPageSetPageUIClient(_webView.pageRef, &uiClient); - - WKPageHistoryClient historyClient = { - 0, - self, - _didNavigateWithNavigationData, - _didPerformClientRedirect, - _didPerformServerRedirect, - _didUpdateHistoryTitle, - }; - - WKPageSetPageHistoryClient(_webView.pageRef, &historyClient); } - (void)didStartProgress @@ -410,11 +435,13 @@ static void _didUpdateHistoryTitle(WKPageRef page, WKStringRef title, WKURLRef U - (void)updateProvisionalURLForFrame:(WKFrameRef)frame { - WKURLRef url = WKFrameGetProvisionalURL(frame); + WKURLRef url = WKFrameCopyProvisionalURL(frame); if (!url) return; CFURLRef cfSourceURL = WKURLCopyCFURL(0, url); + WKURLRelease(url); + [urlText setStringValue:(NSString*)CFURLGetString(cfSourceURL)]; CFRelease(cfSourceURL); } diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m index f36aaae..cd5ee00 100644 --- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m +++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m @@ -65,9 +65,12 @@ void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleF { } -void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) +void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo) { - CFURLRef cfURL = WKURLCopyCFURL(0, WKBundleFrameGetURL(WKBundlePageGetMainFrame(page))); + WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)); + CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); + WKURLRelease(wkURL); + LOG(@"WKBundlePageClient - _didClearWindowForFrame %@", [(NSURL *)cfURL absoluteString]); CFRelease(cfURL); diff --git a/WebKitTools/MiniBrowser/win/stdafx.h b/WebKitTools/MiniBrowser/win/stdafx.h index c5a35f9..0522a17 100644 --- a/WebKitTools/MiniBrowser/win/stdafx.h +++ b/WebKitTools/MiniBrowser/win/stdafx.h @@ -28,3 +28,4 @@ #include <tchar.h> #include <windows.h> + diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp index 25765be..288472c 100644 --- a/WebKitTools/QtTestBrowser/main.cpp +++ b/WebKitTools/QtTestBrowser/main.cpp @@ -92,29 +92,6 @@ static bool gUseFrameFlattening = false; static bool gUseQGLWidgetViewport = false; #endif -class NotificationsPermissionController : public QObject { - Q_OBJECT -public: - NotificationsPermissionController(QObject* parent) : QObject(parent) - { - DumpRenderTreeSupportQt::setNotificationsReceiver(this); - DumpRenderTreeSupportQt::setCheckPermissionFunction(checkPermission); - DumpRenderTreeSupportQt::setRequestPermissionFunction(requestPermission); - } - - static void checkPermission(QObject*, const QUrl&, NotificationPermission& permission) - { - permission = NotificationAllowed; - } - - static void requestPermission(QObject*, const QString& origin) - { - DumpRenderTreeSupportQt::allowNotificationForOrigin(origin); - } -}; - -NotificationsPermissionController* notificationsPermissionController = 0; - class LauncherWindow : public MainWindow { Q_OBJECT @@ -233,8 +210,6 @@ LauncherWindow::LauncherWindow(LauncherWindow* other, bool shareScene) } createChrome(); - if (!notificationsPermissionController) - notificationsPermissionController = new NotificationsPermissionController(QCoreApplication::instance()); } LauncherWindow::~LauncherWindow() @@ -885,16 +860,6 @@ void LauncherWindow::createChrome() toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool))); QMenu* toolsMenu = menuBar()->addMenu("&Develop"); - toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); - QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); - showInspectorAction->setCheckable(true); - showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); - touchMockAction->setCheckable(true); - touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); -#endif QWebSettings* settings = page()->settings(); @@ -907,24 +872,6 @@ void LauncherWindow::createChrome() toggleWebGL->setCheckable(true); toggleWebGL->setChecked(settings->testAttribute(QWebSettings::WebGLEnabled)); - QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); - toggleAcceleratedCompositing->setCheckable(true); - toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); - toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); - toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); - toggleResizesToContents->setCheckable(true); - toggleResizesToContents->setChecked(false); - toggleResizesToContents->setEnabled(isGraphicsBased()); - toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - - QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); - toggleTiledBackingStore->setCheckable(true); - toggleTiledBackingStore->setChecked(false); - toggleTiledBackingStore->setEnabled(isGraphicsBased()); - toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool))); spatialNavigationAction->setCheckable(true); spatialNavigationAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S)); @@ -933,6 +880,14 @@ void LauncherWindow::createChrome() toggleFrameFlattening->setCheckable(true); toggleFrameFlattening->setChecked(settings->testAttribute(QWebSettings::FrameFlatteningEnabled)); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool))); + touchMockAction->setCheckable(true); + touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T)); +#endif + + toolsMenu->addSeparator(); + QAction* toggleInterruptingJavaScripteEnabled = toolsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool))); toggleInterruptingJavaScripteEnabled->setCheckable(true); toggleInterruptingJavaScripteEnabled->setChecked(false); @@ -941,44 +896,43 @@ void LauncherWindow::createChrome() toggleJavascriptCanOpenWindows->setCheckable(true); toggleJavascriptCanOpenWindows->setChecked(false); -#if defined(QT_CONFIGURED_WITH_OPENGL) - QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); - toggleQGLWidgetViewport->setCheckable(true); - toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); - toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); - toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); -#endif + toolsMenu->addSeparator(); QAction* userAgentAction = toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog())); userAgentAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_U)); - graphicsViewMenu->addSeparator(); - - m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); - m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipAnimated->setEnabled(isGraphicsBased()); + toolsMenu->addAction("Select Elements...", this, SLOT(selectElements())); - m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); - m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - m_flipYAnimated->setEnabled(isGraphicsBased()); + QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); + showInspectorAction->setCheckable(true); + showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); - if (isGraphicsBased()) { - WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); - connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); - connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); - } + // GraphicsView sub menu. + QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); + toggleAcceleratedCompositing->setCheckable(true); + toggleAcceleratedCompositing->setChecked(settings->testAttribute(QWebSettings::AcceleratedCompositingEnabled)); + toggleAcceleratedCompositing->setEnabled(isGraphicsBased()); + toggleAcceleratedCompositing->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - graphicsViewMenu->addSeparator(); + QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); + toggleResizesToContents->setCheckable(true); + toggleResizesToContents->setChecked(false); + toggleResizesToContents->setEnabled(isGraphicsBased()); + toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); - cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - cloneWindow->setEnabled(isGraphicsBased()); + QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); + toggleTiledBackingStore->setCheckable(true); + toggleTiledBackingStore->setChecked(false); + toggleTiledBackingStore->setEnabled(isGraphicsBased()); + toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); - showFPS->setCheckable(true); - showFPS->setEnabled(isGraphicsBased()); - showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); - showFPS->setChecked(gShowFrameRate); +#if defined(QT_CONFIGURED_WITH_OPENGL) + QAction* toggleQGLWidgetViewport = graphicsViewMenu->addAction("Toggle use of QGLWidget Viewport", this, SLOT(toggleQGLWidgetViewport(bool))); + toggleQGLWidgetViewport->setCheckable(true); + toggleQGLWidgetViewport->setChecked(gUseQGLWidgetViewport); + toggleQGLWidgetViewport->setEnabled(isGraphicsBased()); + toggleQGLWidgetViewport->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); +#endif QMenu* viewportUpdateMenu = graphicsViewMenu->addMenu("Change Viewport Update Mode"); viewportUpdateMenu->setEnabled(isGraphicsBased()); @@ -1025,6 +979,34 @@ void LauncherWindow::createChrome() viewportUpdateModeActions->addAction(smartUpdate); viewportUpdateModeActions->addAction(boundingRectUpdate); viewportUpdateModeActions->addAction(noUpdate); + + graphicsViewMenu->addSeparator(); + + m_flipAnimated = graphicsViewMenu->addAction("Animated Flip"); + m_flipAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipAnimated->setEnabled(isGraphicsBased()); + + m_flipYAnimated = graphicsViewMenu->addAction("Animated Y-Flip"); + m_flipYAnimated->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + m_flipYAnimated->setEnabled(isGraphicsBased()); + + if (isGraphicsBased()) { + WebViewGraphicsBased* view = static_cast<WebViewGraphicsBased*>(m_view); + connect(m_flipAnimated, SIGNAL(triggered()), view, SLOT(animatedFlip())); + connect(m_flipYAnimated, SIGNAL(triggered()), view, SLOT(animatedYFlip())); + } + + QAction* cloneWindow = graphicsViewMenu->addAction("Clone Window", this, SLOT(cloneWindow())); + cloneWindow->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + cloneWindow->setEnabled(isGraphicsBased()); + + graphicsViewMenu->addSeparator(); + + QAction* showFPS = graphicsViewMenu->addAction("Show FPS", this, SLOT(showFPS(bool))); + showFPS->setCheckable(true); + showFPS->setEnabled(isGraphicsBased()); + showFPS->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); + showFPS->setChecked(gShowFrameRate); } QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp index 2a3aae6..ee0232b 100644 --- a/WebKitTools/QtTestBrowser/webpage.cpp +++ b/WebKitTools/QtTestBrowser/webpage.cpp @@ -48,6 +48,9 @@ WebPage::WebPage(QObject* parent) connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); + connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); + connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&))); + connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain))); } void WebPage::applyProxy() @@ -162,3 +165,23 @@ void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authe delete dialog; } + +void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain) +{ + setUserPermission(frame, domain, PermissionGranted); +} + +void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy) +{ + switch (domain) { + case NotificationsPermissionDomain: + policy = PermissionGranted; + break; + default: + break; + } +} + +void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain) +{ +} diff --git a/WebKitTools/QtTestBrowser/webpage.h b/WebKitTools/QtTestBrowser/webpage.h index 03cde43..15ae369 100644 --- a/WebKitTools/QtTestBrowser/webpage.h +++ b/WebKitTools/QtTestBrowser/webpage.h @@ -57,6 +57,9 @@ public slots: void setUserAgent(const QString& ua) { m_userAgent = ua; } bool shouldInterruptJavaScript(); void authenticationRequired(QNetworkReply*, QAuthenticator*); + void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); + void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy); + void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); private: void applyProxy(); diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit index 57aab45..21214cc 100755 --- a/WebKitTools/Scripts/build-webkit +++ b/WebKitTools/Scripts/build-webkit @@ -61,7 +61,7 @@ my ($linkPrefetchSupport, $threeDCanvasSupport, $threeDRenderingSupport, $channe $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport, $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $webTimingSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport, $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport, - $fileReaderSupport, $fileWriterSupport, $directoryUploadSupport); + $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport); my @features = ( { option => "link-prefetch", desc => "Toggle pre fetching support", @@ -201,6 +201,9 @@ my @features = ( { option => "file-writer", desc => "Toggle FileWriter support", define => "ENABLE_FILE_WRITER", default => 0, value => \$fileWriterSupport }, + + { option => "file-system", desc => "Toggle FileSystem support", + define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport }, ); # Update defaults from Qt's project file diff --git a/WebKitTools/Scripts/check-for-inappropriate-files-in-framework b/WebKitTools/Scripts/check-for-inappropriate-files-in-framework index 2bc65d4..a323bc4 100755 --- a/WebKitTools/Scripts/check-for-inappropriate-files-in-framework +++ b/WebKitTools/Scripts/check-for-inappropriate-files-in-framework @@ -25,6 +25,7 @@ base_directory = ENV['TARGET_BUILD_DIR'] or throw "Unable to find TARGET_BUILD_DIR in the environment!" project_name = ENV['PROJECT_NAME'] or throw "Unable to find PROJECT_NAME in the environment!" +is_shallow_bundle = (ENV['SHALLOW_BUNDLE'] || "NO").upcase == "YES" $INAPPROPRIATE_FILES = { "WebCore" => { "Resources" => ["*.css", "*.in", "*.idl"] } } @@ -41,12 +42,13 @@ def print_inappropriate_file_error framework, relative_path print_error "#{framework}.framework/#{relative_path} should not be present in the framework." end -def check_framework framework +def check_framework framework, is_shallow_bundle $INAPPROPRIATE_FILES[framework].each do |directory, patterns| - Dir.chdir "#{framework}.framework/Versions/A/#{directory}" do + framework_bundle_path = is_shallow_bundle ? "#{framework}.framework" : "#{framework}.framework/Versions/A/#{directory}" + Dir.chdir framework_bundle_path do patterns.each do |pattern| Dir.glob(pattern).each do |inappropriate_file| - print_inappropriate_file_error framework, "Resources/#{inappropriate_file}" + print_inappropriate_file_error framework, is_shallow_bundle ? inappropriate_file : "#{directory}/#{inappropriate_file}" File.unlink inappropriate_file end end @@ -54,7 +56,7 @@ def check_framework framework end end -check_framework project_name +check_framework project_name, is_shallow_bundle if $error_printed STDERR.puts diff --git a/WebKitTools/Scripts/check-for-webkit-framework-include-consistency b/WebKitTools/Scripts/check-for-webkit-framework-include-consistency index 693dd6a..339fa7e 100755 --- a/WebKitTools/Scripts/check-for-webkit-framework-include-consistency +++ b/WebKitTools/Scripts/check-for-webkit-framework-include-consistency @@ -24,7 +24,8 @@ # THE POSSIBILITY OF SUCH DAMAGE. -base_directory = ENV['TARGET_BUILD_DIR'] +base_directory = ENV['TARGET_BUILD_DIR'] or throw "Unable to find TARGET_BUILD_DIR in the environment!" +is_shallow_bundle = (ENV['SHALLOW_BUNDLE'] || "NO").upcase == "YES" unless base_directory throw "Unable to find TARGET_BUILD_DIR in the environment!" @@ -44,8 +45,9 @@ def print_error msg STDERR.puts "ERROR: #{msg}" end -def build_header_maps - all_headers = `find WebKit.framework/Versions/A/{,Private}Headers -type f -name '*.h'`.split +def build_header_maps is_shallow_bundle + current_version_path = is_shallow_bundle ? "" : "Versions/A/" + all_headers = `find WebKit.framework/#{current_version_path}{,Private}Headers -type f -name '*.h'`.split all_headers.each do |header| if /\/Headers\/(.*)/.match(header) @@ -97,7 +99,7 @@ def verify_includes(header, permitted_types) end end -build_header_maps +build_header_maps is_shallow_bundle $HEADERS_BY_TYPE.each do |header_type, headers| permitted_types = $PERMITTED_INCLUDE_TYPES[header_type] diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests index 88c0a05..af82545 100755 --- a/WebKitTools/Scripts/old-run-webkit-tests +++ b/WebKitTools/Scripts/old-run-webkit-tests @@ -214,12 +214,6 @@ if (isAppleMacWebKit()) { } } elsif (isGtk()) { $platform = "gtk"; - if (!$ENV{"WEBKIT_TESTFONTS"}) { - print "The WEBKIT_TESTFONTS environment variable is not defined.\n"; - print "You must set it before running the tests.\n"; - print "Use git to grab the actual fonts from http://gitorious.org/qtwebkit/testfonts\n"; - exit 1; - } } elsif (isWx()) { $platform = "wx"; } elsif (isCygwin()) { @@ -234,6 +228,16 @@ if (isAppleMacWebKit()) { } } +if (isQt() || isGtk() || isCygwin()) { + my $testfontPath = $ENV{"WEBKIT_TESTFONTS"}; + if (!$testfontPath || !-d "$testfontPath") { + print "The WEBKIT_TESTFONTS environment variable is not defined or not set properly\n"; + print "You must set it before running the tests.\n"; + print "Use git to grab the actual fonts from http://gitorious.org/qtwebkit/testfonts\n"; + exit 1; + } +} + if (!defined($platform)) { print "WARNING: Your platform is not recognized. Any platform-specific results will be generated in platform/undefined.\n"; $platform = "undefined"; diff --git a/WebKitTools/Scripts/svn-unapply b/WebKitTools/Scripts/svn-unapply index e502560..53ab1b5 100755 --- a/WebKitTools/Scripts/svn-unapply +++ b/WebKitTools/Scripts/svn-unapply @@ -139,7 +139,9 @@ sub patch($) { my ($diffHashRef) = @_; - my $patch = $diffHashRef->{svnConvertedText}; + # Make sure $patch is initialized to some value. There is no + # svnConvertedText when reversing an svn copy/move. + my $patch = $diffHashRef->{svnConvertedText} || ""; my $fullPath = $diffHashRef->{indexPath}; my $isSvnBinary = $diffHashRef->{isBinary} && $diffHashRef->{isSvn}; @@ -201,7 +203,7 @@ sub patch($) # FIXME: This should use the same logic as svn-apply's deletion # code. In particular, svn-apply's scmRemove() subroutine # should be used here. - unapplyPatch($patch, $fullPath, ["--force"]); + unapplyPatch($patch, $fullPath, ["--force"]) if $patch; unlink($fullPath) if -z $fullPath; system "svn", "revert", $fullPath; } diff --git a/WebKitTools/Scripts/webkitdirs.pm b/WebKitTools/Scripts/webkitdirs.pm index d95f2a1..745e808 100644 --- a/WebKitTools/Scripts/webkitdirs.pm +++ b/WebKitTools/Scripts/webkitdirs.pm @@ -674,7 +674,7 @@ sub determineQtFeatureDefaults() my $defaults = `qmake CONFIG+=compute_defaults 2>&1`; chdir $originalCwd; - while ($defaults =~ m/(\S*?)=(.*?)( |$)/gi) { + while ($defaults =~ m/(\S+?)=(\S+?)/gi) { $qtFeatureDefaults{$1}=$2; } } diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py index e7f9ac8..f8b181c 100644 --- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -34,6 +34,7 @@ from __future__ import with_statement import codecs import logging import os +import re import shutil import signal import subprocess @@ -212,6 +213,16 @@ class ChromiumPort(base.Port): return file.read() def test_expectations_overrides(self): + # FIXME: This drt_overrides handling should be removed when we switch + # from tes_shell to DRT. + drt_overrides = '' + if self._options.use_drt: + drt_overrides_path = self.path_from_webkit_base('LayoutTests', + 'platform', 'chromium', 'drt_expectations.txt') + if os.path.exists(drt_overrides_path): + with codecs.open(drt_overrides_path, "r", "utf-8") as file: + drt_overrides = file.read() + try: overrides_path = self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') @@ -220,7 +231,7 @@ class ChromiumPort(base.Port): if not os.path.exists(overrides_path): return None with codecs.open(overrides_path, "r", "utf-8") as file: - return file.read() + return file.read() + drt_overrides def test_platform_names(self): return self.test_base_platform_names() + ('win-xp', @@ -382,9 +393,12 @@ class ChromiumDriver(base.Driver): if line.startswith("#URL:"): actual_uri = line.rstrip()[5:] if uri != actual_uri: - _log.fatal("Test got out of sync:\n|%s|\n|%s|" % - (uri, actual_uri)) - raise AssertionError("test out of sync") + # GURL capitalizes the drive letter of a file URL. + if (not re.search("^file:///[a-z]:", uri) or + uri.lower() != actual_uri.lower()): + _log.fatal("Test got out of sync:\n|%s|\n|%s|" % + (uri, actual_uri)) + raise AssertionError("test out of sync") elif line.startswith("#MD5:"): actual_checksum = line.rstrip()[5:] elif line.startswith("#TEST_TIMED_OUT"): diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py index 611afdc..770ab40 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py @@ -1884,6 +1884,10 @@ def check_for_null(file_extension, clean_lines, line_number, error): if search(r'\bg_str(join|concat)\b', line): return + # Don't warn about NULL usage in gdk_pixbuf_save_to_*{join,concat}(). See Bug 43090. + if search(r'\bgdk_pixbuf_save_to\w+\b', line): + return + if search(r'\bNULL\b', line): error(line_number, 'readability/null', 5, 'Use 0 instead of NULL.') return @@ -1916,7 +1920,7 @@ def get_line_width(line): return len(line) -def check_style(clean_lines, line_number, file_extension, file_state, error): +def check_style(clean_lines, line_number, file_extension, class_state, file_state, error): """Checks rules from the 'C++ style rules' section of cppguide.html. Most of these rules are hard to test (naming, comment style), but we @@ -1927,6 +1931,8 @@ def check_style(clean_lines, line_number, file_extension, file_state, error): clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. file_extension: The extension (without the dot) of the filename. + class_state: A _ClassState instance which maintains information about + the current stack of nested class declarations being parsed. file_state: A _FileState instance which maintains information about the state of things in the file. error: The function to call with any errors found. @@ -1987,6 +1993,10 @@ def check_style(clean_lines, line_number, file_extension, file_state, error): and not ((cleansed_line.find('case ') != -1 or cleansed_line.find('default:') != -1) and cleansed_line.find('break;') != -1) + # Also it's ok to have many commands in trivial single-line accessors in class definitions. + and not (match(r'.*\(.*\).*{.*.}', line) + and class_state.classinfo_stack + and line.count('{') == line.count('}')) and not cleansed_line.startswith('#define ')): error(line_number, 'whitespace/newline', 4, 'More than one command on the same line') @@ -2841,7 +2851,7 @@ def process_line(filename, file_extension, if search(r'\bNOLINT\b', raw_lines[line]): # ignore nolint lines return check_for_multiline_comments_and_strings(clean_lines, line, error) - check_style(clean_lines, line, file_extension, file_state, error) + check_style(clean_lines, line, file_extension, class_state, file_state, error) check_language(filename, clean_lines, line, file_extension, include_state, error) check_for_non_standard_constructs(clean_lines, line, class_state, error) diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py index 2dde549..ee829aa 100644 --- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -164,7 +164,7 @@ class CppStyleTestBase(unittest.TestCase): class_state = cpp_style._ClassState() file_state = cpp_style._FileState() for i in xrange(lines.num_lines()): - cpp_style.check_style(lines, i, file_extension, file_state, error_collector) + cpp_style.check_style(lines, i, file_extension, class_state, file_state, error_collector) cpp_style.check_for_non_standard_constructs(lines, i, class_state, error_collector) class_state.check_finished(error_collector) @@ -2594,6 +2594,19 @@ class NoNonVirtualDestructorsTest(CppStyleTestBase): self.assert_multi_line_lint( 'class Foo { void foo(); };', 'More than one command on the same line [whitespace/newline] [4]') + self.assert_multi_line_lint( + 'class MyClass {\n' + ' int getIntValue() { ASSERT(m_ptr); return *m_ptr; }\n' + '};\n', + '') + self.assert_multi_line_lint( + 'class MyClass {\n' + ' int getIntValue()\n' + ' {\n' + ' ASSERT(m_ptr); return *m_ptr;\n' + ' }\n' + '};\n', + 'More than one command on the same line [whitespace/newline] [4]') self.assert_multi_line_lint( '''class Qualified::Goo : public Foo { @@ -3472,6 +3485,15 @@ class WebKitStyleTest(CppStyleTestBase): self.assert_lint( 'gchar* result = g_strjoin(",", "part1", NULL);', '') + self.assert_lint( + 'gchar* result = gdk_pixbuf_save_to_callback(pixbuf, function, data, type, error, NULL);', + '') + self.assert_lint( + 'gchar* result = gdk_pixbuf_save_to_buffer(pixbuf, function, data, type, error, NULL);', + '') + self.assert_lint( + 'gchar* result = gdk_pixbuf_save_to_stream(pixbuf, function, data, type, error, NULL);', + '') # 2. C++ and C bool values should be written as true and # false. Objective-C BOOL values should be written as YES and NO. diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py index 8f0d153..9ceb2cb 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py @@ -35,10 +35,6 @@ from webkitpy.tool.steps.options import Options class AbstractStep(object): def __init__(self, tool, options): self._tool = tool - if options.no_squash: - raise ScriptError('--no-squash has been removed. Use "--git-commit=HEAD.." or "-g HEAD.." to operate on the working copy.') - if options.squash: - raise ScriptError('--squash has been removed. It is now the default behavior if --git-commit is omitted.') self._options = options self._port = None @@ -76,9 +72,6 @@ class AbstractStep(object): return [ # We need this option here because cached_lookup uses it. :( Options.git_commit, - # FIXME: Get rid of these. - Options.no_squash, - Options.squash, ] def run(self, state): diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/options.py b/WebKitTools/Scripts/webkitpy/tool/steps/options.py index 9c73f5a..e7e3855 100644 --- a/WebKitTools/Scripts/webkitpy/tool/steps/options.py +++ b/WebKitTools/Scripts/webkitpy/tool/steps/options.py @@ -46,8 +46,6 @@ class Options(object): git_commit = make_option("-g", "--git-commit", action="store", dest="git_commit", help="Operate on a local commit. If a range, the commits are squashed into one. HEAD.. operates on working copy changes only.") local_commit = make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch") non_interactive = make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible.") - # FIXME: Remove --no-squash, once people have adjusted to using --git-commit. - no_squash = make_option("--no-squash", action="store_true", dest="no_squash", default=False, help="Obsolete. Use --git-commit=HEAD.. instead.") obsolete_patches = make_option("--no-obsolete", action="store_false", dest="obsolete_patches", default=True, help="Do not obsolete old patches before posting this one.") open_bug = make_option("--open-bug", action="store_true", dest="open_bug", default=False, help="Opens the associated bug in a browser.") parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.") @@ -56,7 +54,5 @@ class Options(object): request_commit = make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review.") review = make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review.") reviewer = make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER.") - # FIXME: Remove --squash, once people have adjusted to using --git-commit. - squash = make_option("-s", "--squash", action="store_true", dest="squash", default=False, help="Obsolete. This is now the default behavior.") test = make_option("--test", action="store_true", dest="test", default=False, help="Run run-webkit-tests before committing.") update = make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory.") diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm index d72d4fc..fa47143 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm @@ -260,7 +260,7 @@ EOF push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n"); - push(@parameters, $self->_paramterExpression($parameter)); + push(@parameters, $self->_parameterExpression($parameter)); } my $isVoidReturn = $function->signature->type eq "void"; @@ -343,7 +343,10 @@ sub _includeHeaders my ($self, $headers, $idlType, $signature) = @_; return unless defined $idlType; - return if $idlType eq "boolean" or $$self{codeGenerator}->IsNonPointerType($idlType); + return if $idlType eq "boolean"; + return if $idlType eq "object"; + return if $$self{codeGenerator}->IsNonPointerType($idlType); + return if $$self{codeGenerator}->IsStringType($idlType); $$headers{_className($idlType) . ".h"} = 1; $$headers{_implementationClassName($idlType) . ".h"} = 1; @@ -385,6 +388,7 @@ sub _platformType return undef unless defined $idlType; return "bool" if $idlType eq "boolean"; + return "JSValueRef" if $idlType eq "object"; return "JSRetainPtr<JSStringRef>" if $$self{codeGenerator}->IsStringType($idlType); return "double" if $$self{codeGenerator}->IsNonPointerType($idlType); return _implementationClassName($idlType); @@ -396,8 +400,9 @@ sub _platformTypeConstructor my $idlType = $signature->type; - return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($idlType); return "JSValueToBoolean(context, $argumentName)" if $idlType eq "boolean"; + return "$argumentName" if $idlType eq "object"; + return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($idlType); return "JSValueToNumber(context, $argumentName, 0)" if $$self{codeGenerator}->IsNonPointerType($idlType); return "to" . _implementationClassName($idlType) . "(context, $argumentName)"; } @@ -413,6 +418,7 @@ sub _platformTypeVariableDeclaration "bool" => 1, "double" => 1, "JSRetainPtr<JSStringRef>" => 1, + "JSValueRef" => 1, ); my $nullValue = "0"; @@ -429,19 +435,17 @@ sub _returnExpression { my ($self, $signature, $expression) = @_; - my $convertNullStringAttribute = $signature->extendedAttributes->{"ConvertNullStringTo"}; - my $nullOrEmptyString = "NullStringAsEmptyString"; - $nullOrEmptyString = "NullStringAsNull" if defined $convertNullStringAttribute && $convertNullStringAttribute eq "Null"; - my $returnIDLType = $signature->type; return "JSValueMakeUndefined(context)" if $returnIDLType eq "void"; return "JSValueMakeBoolean(context, ${expression})" if $returnIDLType eq "boolean"; + return "${expression}" if $returnIDLType eq "object"; return "JSValueMakeNumber(context, ${expression})" if $$self{codeGenerator}->IsNonPointerType($returnIDLType); + return "JSValueMakeStringOrNull(context, ${expression}.get())" if $$self{codeGenerator}->IsStringType($returnIDLType); return "toJS(context, WTF::getPtr(${expression}))"; } -sub _paramterExpression +sub _parameterExpression { my ($self, $parameter) = @_; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h index cf56c5d..9cb97af 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/JSWrappable.h @@ -37,6 +37,11 @@ public: virtual JSClassRef wrapperClass() = 0; }; +inline JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull) +{ + return stringOrNull ? JSValueMakeString(context, stringOrNull) : JSValueMakeNull(context); +} + } // namespace WTR #endif // JSWrappable_h diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index 7da2e81..a0fbb85 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -26,18 +26,35 @@ module WTR { interface LayoutTestController { + // The basics. void dumpAsText(); - void dumpStatusCallbacks(); - + void dumpChildFramesAsText(); void waitUntilDone(); void notifyDone(); - // Repaint testing + // Other dumping. + void dumpChildFrameScrollPositions(); + void dumpEditingCallbacks(); + void dumpSelectionRect(); + void dumpStatusCallbacks(); + + // Special options. + void keepWebHistory(); + void setAcceptsEditing(in boolean value); + + // Special DOM functions. + object computedStyleIncludingVisitedInfo(in object element); + DOMString counterValueForElementById(in DOMString elementId); + DOMString markerTextForListItem(in object element); + void execCommand(in DOMString name, in DOMString argument); + boolean isCommandEnabled(in DOMString name); + + // Repaint testing. void testRepaint(); void repaintSweepHorizontally(); void display(); - // Animation testing + // Animation testing. int numberOfActiveAnimations(); boolean pauseAnimationAtTimeOnElementWithId(in DOMString animationName, in double time, in DOMString elementId); }; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp index d3c66fd..0e99dde 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp @@ -27,11 +27,12 @@ #include "ActivateFonts.h" #include "InjectedBundlePage.h" +#include <WebKit2/WebKit2.h> #include <WebKit2/WKBundle.h> #include <WebKit2/WKBundlePage.h> +#include <WebKit2/WKBundlePrivate.h> #include <WebKit2/WKRetainPtr.h> #include <WebKit2/WKStringCF.h> -#include <WebKit2/WebKit2.h> #include <wtf/RetainPtr.h> namespace WTR { @@ -57,9 +58,9 @@ void InjectedBundle::_willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page); } -void InjectedBundle::_didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) +void InjectedBundle::_didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo) { - static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didRecieveMessage(message); + static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(message); } void InjectedBundle::initialize(WKBundleRef bundle) @@ -71,7 +72,7 @@ void InjectedBundle::initialize(WKBundleRef bundle) this, _didCreatePage, _willDestroyPage, - _didRecieveMessage + _didReceiveMessage }; WKBundleSetClient(m_bundle, &client); @@ -98,7 +99,7 @@ void InjectedBundle::willDestroyPage(WKBundlePageRef page) delete m_pages.take(page); } -void InjectedBundle::didRecieveMessage(WKStringRef message) +void InjectedBundle::didReceiveMessage(WKStringRef message) { CFStringRef cfMessage = WKStringCopyCFString(0, message); if (CFEqual(cfMessage, CFSTR("BeginTest"))) { @@ -116,7 +117,14 @@ void InjectedBundle::didRecieveMessage(WKStringRef message) void InjectedBundle::reset() { m_outputStream.str(""); - m_layoutTestController = LayoutTestController::create(std::string("")); + m_layoutTestController = LayoutTestController::create(); + WKBundleSetShouldTrackVisitedLinks(m_bundle, false); + WKBundleRemoveAllVisitedLinks(m_bundle); +} + +void InjectedBundle::setShouldTrackVisitedLinks() +{ + WKBundleSetShouldTrackVisitedLinks(m_bundle, true); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h index 1581ebc..9bda922 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h @@ -52,17 +52,19 @@ public: std::ostringstream& os() { return m_outputStream; } + void setShouldTrackVisitedLinks(); + private: InjectedBundle(); ~InjectedBundle(); static void _didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); static void _willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo); - static void _didRecieveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo); + static void _didReceiveMessage(WKBundleRef bundle, WKStringRef message, const void *clientInfo); void didCreatePage(WKBundlePageRef page); void willDestroyPage(WKBundlePageRef page); - void didRecieveMessage(WKStringRef message); + void didReceiveMessage(WKStringRef message); void reset(); diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index cbba470..3632fb9 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -26,28 +26,96 @@ #include "InjectedBundlePage.h" #include "InjectedBundle.h" +#include <JavaScriptCore/JSRetainPtr.h> +#include <WebKit2/WKArray.h> #include <WebKit2/WKBundleFrame.h> +#include <WebKit2/WKBundleNode.h> #include <WebKit2/WKBundlePagePrivate.h> #include <WebKit2/WKRetainPtr.h> +#include <WebKit2/WKBundleRange.h> #include <WebKit2/WKString.h> #include <WebKit2/WKStringCF.h> #include <wtf/PassOwnPtr.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> +using namespace std; + namespace WTR { -static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef) +static ostream& operator<<(ostream& out, CFStringRef stringRef) +{ + if (!stringRef) + return out; + CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef), kCFStringEncodingUTF8) + 1; + Vector<char> buffer(bufferLength); + if (!CFStringGetCString(stringRef, buffer.data(), bufferLength, kCFStringEncodingUTF8)) + return out; + return out << buffer.data(); +} + +static ostream& operator<<(ostream& out, const RetainPtr<CFStringRef>& stringRef) +{ + return out << stringRef.get(); +} + +static ostream& operator<<(ostream& out, WKStringRef stringRef) +{ + if (!stringRef) + return out; + RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, stringRef)); + return out << cfString; +} + +static ostream& operator<<(ostream& out, const WKRetainPtr<WKStringRef>& stringRef) +{ + return out << stringRef.get(); +} + +static ostream& operator<<(ostream& out, JSStringRef stringRef) +{ + if (!stringRef) + return out; + CFIndex bufferLength = JSStringGetMaximumUTF8CStringSize(stringRef) + 1; + Vector<char> buffer(bufferLength); + JSStringGetUTF8CString(stringRef, buffer.data(), bufferLength); + return out << buffer.data(); +} + +static ostream& operator<<(ostream& out, const JSRetainPtr<JSStringRef>& stringRef) +{ + return out << stringRef.get(); +} + +static string dumpPath(WKBundleNodeRef node) { - RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef)); - CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1; - OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength)); - if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) { - buffer->shrink(1); - (*buffer)[0] = 0; - } else - buffer->shrink(strlen(buffer->data()) + 1); - return buffer.release(); + if (!node) + return "(null)"; + WKRetainPtr<WKStringRef> nodeName(AdoptWK, WKBundleNodeCopyNodeName(node)); + ostringstream out; + out << nodeName; + if (WKBundleNodeRef parent = WKBundleNodeGetParent(node)) + out << " > " << dumpPath(parent); + return out.str(); +} + +static ostream& operator<<(ostream& out, WKBundleRangeRef rangeRef) +{ + if (rangeRef) + out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef)); + else + out << "(null)"; + + return out; +} + +static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style) +{ + // DumpRenderTree calls -[DOMCSSStyleDeclaration description], which just dumps class name and object address. + // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call + // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface. + out << "<DOMCSSStyleDeclaration ADDRESS>"; + return out; } InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) @@ -78,6 +146,23 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) _willRunJavaScriptPrompt }; WKBundlePageSetUIClient(m_page, &uiClient); + + WKBundlePageEditorClient editorClient = { + 0, + this, + _shouldBeginEditing, + _shouldEndEditing, + _shouldInsertNode, + _shouldInsertText, + _shouldDeleteRange, + _shouldChangeSelectedRange, + _shouldApplyStyle, + _didBeginEditing, + _didEndEditing, + _didChange, + _didChangeSelection + }; + WKBundlePageSetEditorClient(m_page, &editorClient); } InjectedBundlePage::~InjectedBundlePage() @@ -121,9 +206,9 @@ void InjectedBundlePage::_didReceiveTitleForFrame(WKBundlePageRef page, WKString static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveTitleForFrame(title, frame); } -void InjectedBundlePage::_didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo) +void InjectedBundlePage::_didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo) { - static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, ctx, window); + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, context, window); } void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) @@ -144,20 +229,128 @@ void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame) { } +static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName) +{ + if (!object) + return 0; + JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName)); + JSValueRef exception; + return JSObjectGetProperty(context, object, propertyNameString.get(), &exception); +} + +static JSObjectRef propertyObject(JSContextRef context, JSObjectRef object, const char* propertyName) +{ + JSValueRef value = propertyValue(context, object, propertyName); + if (!value || !JSValueIsObject(context, value)) + return 0; + return const_cast<JSObjectRef>(value); +} + +static JSRetainPtr<JSStringRef> propertyString(JSContextRef context, JSObjectRef object, const char* propertyName) +{ + JSValueRef value = propertyValue(context, object, propertyName); + if (!value) + return 0; + JSValueRef exception; + return JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, value, &exception)); +} + +static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName) +{ + JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame); + JSValueRef value = propertyValue(context, JSContextGetGlobalObject(context), propertyName); + if (!value) + return 0; + JSValueRef exception; + return JSValueToNumber(context, value, &exception); +} + +enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName }; + +static void dumpFrameScrollPosition(WKBundleFrameRef frame, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName) +{ + double x = numericWindowPropertyValue(frame, "pageXOffset"); + double y = numericWindowPropertyValue(frame, "pageYOffset"); + if (fabs(x) > 0.00000001 || fabs(y) > 0.00000001) { + if (shouldIncludeFrameName) { + WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame)); + InjectedBundle::shared().os() << "frame '" << name << "' "; + } + InjectedBundle::shared().os() << "scrolled to " << x << "," << y << "\n"; + } +} + +static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame) +{ + WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); + size_t size = WKArrayGetSize(childFrames.get()); + for (size_t i = 0; i < size; ++i) { + // FIXME: I don't like that we have to const_cast here. Can we change WKArray? + WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i))); + dumpFrameScrollPosition(subframe, ShouldIncludeFrameName); + dumpDescendantFrameScrollPositions(subframe); + } +} + +void InjectedBundlePage::dumpAllFrameScrollPositions() +{ + WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page); + dumpFrameScrollPosition(frame); + dumpDescendantFrameScrollPositions(frame); +} + +static void dumpFrameText(WKBundleFrameRef frame) +{ + JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame); + JSObjectRef document = propertyObject(context, JSContextGetGlobalObject(context), "document"); + JSObjectRef documentElement = propertyObject(context, document, "documentElement"); + InjectedBundle::shared().os() << propertyString(context, documentElement, "innerText") << "\n"; +} + +static void dumpDescendantFramesText(WKBundleFrameRef frame) +{ + WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame)); + size_t size = WKArrayGetSize(childFrames.get()); + for (size_t i = 0; i < size; ++i) { + // FIXME: I don't like that we have to const_cast here. Can we change WKArray? + WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i))); + WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe)); + InjectedBundle::shared().os() << "\n--------\nFrame: '" << subframeName << "'\n--------\n"; + dumpFrameText(subframe); + dumpDescendantFramesText(subframe); + } +} + +void InjectedBundlePage::dumpAllFramesText() +{ + WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page); + dumpFrameText(frame); + dumpDescendantFramesText(frame); +} + void InjectedBundlePage::dump() { InjectedBundle::shared().layoutTestController()->invalidateWaitToDumpWatchdog(); - if (InjectedBundle::shared().layoutTestController()->shouldDumpAsText()) { - // FIXME: Support dumping subframes when layoutTestController()->dumpChildFramesAsText() is true. - WKRetainPtr<WKStringRef> innerText(AdoptWK, WKBundleFrameCopyInnerText(WKBundlePageGetMainFrame(m_page))); - OwnPtr<Vector<char> > utf8InnerText = WKStringToUTF8(innerText.get()); - InjectedBundle::shared().os() << utf8InnerText->data() << "\n"; - } else { - WKRetainPtr<WKStringRef> externalRepresentation(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page)); - OwnPtr<Vector<char> > utf8externalRepresentation = WKStringToUTF8(externalRepresentation.get()); - InjectedBundle::shared().os() << utf8externalRepresentation->data(); + switch (InjectedBundle::shared().layoutTestController()->whatToDump()) { + case LayoutTestController::RenderTree: { + WKRetainPtr<WKStringRef> text(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page)); + InjectedBundle::shared().os() << text; + break; + } + case LayoutTestController::MainFrameText: + dumpFrameText(WKBundlePageGetMainFrame(m_page)); + break; + case LayoutTestController::AllFramesText: + dumpAllFramesText(); + break; } + + if (InjectedBundle::shared().layoutTestController()->shouldDumpAllFrameScrollPositions()) + dumpAllFrameScrollPositions(); + else if (InjectedBundle::shared().layoutTestController()->shouldDumpMainFrameScrollPosition()) + dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page)); + InjectedBundle::shared().done(); } @@ -188,10 +381,10 @@ void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFram { } -void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window) +void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window) { JSValueRef exception = 0; - InjectedBundle::shared().layoutTestController()->makeWindowObject(ctx, window, &exception); + InjectedBundle::shared().layoutTestController()->makeWindowObject(context, window, &exception); } // UI Client Callbacks @@ -224,8 +417,7 @@ void InjectedBundlePage::_willRunJavaScriptPrompt(WKBundlePageRef page, WKString void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t lineNumber) { // FIXME: Strip file: urls. - OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message); - InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << utf8Message->data() << "\n"; + InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << message << "\n"; } void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText) @@ -233,27 +425,174 @@ void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText) if (!InjectedBundle::shared().layoutTestController()->shouldDumpStatusCallbacks()) return; - OwnPtr<Vector<char> > utf8StatusbarText = WKStringToUTF8(statusbarText); - InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << utf8StatusbarText->data() << "\n"; + InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << statusbarText << "\n"; } void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef) { - OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message); - InjectedBundle::shared().os() << "ALERT: " << utf8Message->data() << "\n"; + InjectedBundle::shared().os() << "ALERT: " << message << "\n"; } void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef) { - OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message); - InjectedBundle::shared().os() << "CONFIRM: " << utf8Message->data() << "\n"; + InjectedBundle::shared().os() << "CONFIRM: " << message << "\n"; } void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef) { - OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message); - OwnPtr<Vector<char> > utf8DefaultValue = WKStringToUTF8(defaultValue); - InjectedBundle::shared().os() << "PROMPT: " << utf8Message->data() << ", default text: " << utf8DefaultValue->data() << "\n"; + InjectedBundle::shared().os() << "PROMPT: " << message << ", default text: " << defaultValue << "\n"; +} + +// Editor Client Callbacks + +bool InjectedBundlePage::_shouldBeginEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldBeginEditing(range); } +bool InjectedBundlePage::_shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range); +} + +bool InjectedBundlePage::_shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertNode(node, rangeToReplace, action); +} + +bool InjectedBundlePage::_shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertText(text, rangeToReplace, action); +} + +bool InjectedBundlePage::_shouldDeleteRange(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldDeleteRange(range); +} + +bool InjectedBundlePage::_shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting); +} + +bool InjectedBundlePage::_shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo) +{ + return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldApplyStyle(style, range); +} + +void InjectedBundlePage::_didBeginEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didBeginEditing(notificationName); +} + +void InjectedBundlePage::_didEndEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didEndEditing(notificationName); +} + +void InjectedBundlePage::_didChange(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChange(notificationName); +} + +void InjectedBundlePage::_didChangeSelection(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo) +{ + static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeSelection(notificationName); +} + +bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldBeginEditingInDOMRange:" << range << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << range << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action) +{ + static const char *insertactionstring[] = { + "WebViewInsertActionTyped", + "WebViewInsertActionPasted", + "WebViewInsertActionDropped", + }; + + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(node) << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action) +{ + static const char *insertactionstring[] = { + "WebViewInsertActionTyped", + "WebViewInsertActionPasted", + "WebViewInsertActionDropped", + }; + + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << range << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting) +{ + static const char *affinitystring[] = { + "NSSelectionAffinityUpstream", + "NSSelectionAffinityDownstream" + }; + static const char *boolstring[] = { + "FALSE", + "TRUE" + }; + + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << fromRange << " toDOMRange:" << toRange << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << range << "\n"; + return InjectedBundle::shared().layoutTestController()->shouldAllowEditing(); +} + +void InjectedBundlePage::didBeginEditing(WKStringRef notificationName) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidBeginEditing:" << notificationName << "\n"; +} + +void InjectedBundlePage::didEndEditing(WKStringRef notificationName) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidEndEditing:" << notificationName << "\n"; +} + +void InjectedBundlePage::didChange(WKStringRef notificationName) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChange:" << notificationName << "\n"; +} + +void InjectedBundlePage::didChangeSelection(WKStringRef notificationName) +{ + if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks()) + InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChangeSelection:" << notificationName << "\n"; +} + + } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h index bce9d2c..1b67af0 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h @@ -42,35 +42,62 @@ public: private: // Loader Client - static void _didStartProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didCommitLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); - static void _didReceiveTitleForFrame(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo); - static void _didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window, const void *clientInfo); - void didStartProvisionalLoadForFrame(WKBundleFrameRef frame); - void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame); - void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame); - void didCommitLoadForFrame(WKBundleFrameRef frame); - void didFinishLoadForFrame(WKBundleFrameRef frame); - void didFailLoadWithErrorForFrame(WKBundleFrameRef frame); - void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame); - void didClearWindowForFrame(WKBundleFrameRef frame, JSContextRef ctx, JSObjectRef window); + static void _didStartProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didReceiveServerRedirectForProvisionalLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didFailProvisionalLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didCommitLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didFinishLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void* clientInfo); + static void _didReceiveTitleForFrame(WKBundlePageRef, WKStringRef title, WKBundleFrameRef, const void* clientInfo); + static void _didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window, const void* clientInfo); + void didStartProvisionalLoadForFrame(WKBundleFrameRef); + void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); + void didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef); + void didCommitLoadForFrame(WKBundleFrameRef); + void didFinishLoadForFrame(WKBundleFrameRef); + void didFailLoadWithErrorForFrame(WKBundleFrameRef); + void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef); + void didClearWindowForFrame(WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window); // UI Client - static void _willAddMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void* clientInfo); - static void _willSetStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void* clientInfo); - static void _willRunJavaScriptAlert(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); - static void _willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); - static void _willRunJavaScriptPrompt(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo); + static void _willAddMessageToConsole(WKBundlePageRef, WKStringRef message, uint32_t lineNumber, const void* clientInfo); + static void _willSetStatusbarText(WKBundlePageRef, WKStringRef statusbarText, const void* clientInfo); + static void _willRunJavaScriptAlert(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); + static void _willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo); + static void _willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo); void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber); void willSetStatusbarText(WKStringRef statusbarText); void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef); void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef); + // Editor client + static bool _shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo); + static bool _shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo); + static bool _shouldInsertNode(WKBundlePageRef, WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo); + static bool _shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo); + static bool _shouldDeleteRange(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo); + static bool _shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo); + static bool _shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo); + static void _didBeginEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo); + static void _didEndEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo); + static void _didChange(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo); + static void _didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo); + bool shouldBeginEditing(WKBundleRangeRef); + bool shouldEndEditing(WKBundleRangeRef); + bool shouldInsertNode(WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType); + bool shouldInsertText(WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType); + bool shouldDeleteRange(WKBundleRangeRef); + bool shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting); + bool shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range); + void didBeginEditing(WKStringRef notificationName); + void didEndEditing(WKStringRef notificationName); + void didChange(WKStringRef notificationName); + void didChangeSelection(WKStringRef notificationName); + + void dumpAllFramesText(); + void dumpAllFrameScrollPositions(); + WKBundlePageRef m_page; bool m_isLoading; }; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index fafa1e3..2f59eb1 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -30,24 +30,97 @@ #include "JSLayoutTestController.h" #include <JavaScriptCore/JSRetainPtr.h> #include <WebKit2/WKBundleFrame.h> +#include <WebKit2/WKBundleFramePrivate.h> +#include <WebKit2/WKBundlePagePrivate.h> #include <WebKit2/WKRetainPtr.h> #include <WebKit2/WKStringCF.h> #include <WebKit2/WebKit2.h> namespace WTR { -PassRefPtr<LayoutTestController> LayoutTestController::create(const std::string& testPathOrURL) +// This is lower than DumpRenderTree's timeout, to make it easier to work through the failures +// Eventually it should be changed to match. +static const CFTimeInterval waitToDumpWatchdogInterval = 6.0; + +static RetainPtr<CFStringRef> toCF(JSStringRef string) +{ + return RetainPtr<CFStringRef>(AdoptCF, JSStringCopyCFString(0, string)); +} + +static RetainPtr<CFStringRef> toCF(WKStringRef string) +{ + return RetainPtr<CFStringRef>(AdoptCF, WKStringCopyCFString(0, string)); +} + +static WKRetainPtr<WKStringRef> toWK(JSStringRef string) +{ + return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get())); +} + +static JSRetainPtr<JSStringRef> toJS(WKStringRef string) +{ + return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get())); +} + +static JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string) +{ + return toJS(string.get()); +} + +static void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName)); + JSObjectSetProperty(context, object, propertyNameString.get(), JSWrapper::wrap(context, value), attributes, exception); +} + +static JSValueRef propertyValue(JSContextRef context, JSObjectRef object, const char* propertyName) +{ + if (!object) + return 0; + JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName)); + JSValueRef exception; + return JSObjectGetProperty(context, object, propertyNameString.get(), &exception); +} + +static JSObjectRef propertyObject(JSContextRef context, JSObjectRef object, const char* propertyName) +{ + JSValueRef value = propertyValue(context, object, propertyName); + if (!value || !JSValueIsObject(context, value)) + return 0; + return const_cast<JSObjectRef>(value); +} + +static JSObjectRef getElementById(WKBundleFrameRef frame, JSStringRef elementId) { - return adoptRef(new LayoutTestController(testPathOrURL)); + JSContextRef context = WKBundleFrameGetJavaScriptContext(frame); + JSObjectRef document = propertyObject(context, JSContextGetGlobalObject(context), "document"); + if (!document) + return 0; + JSValueRef getElementById = propertyObject(context, document, "getElementById"); + if (!getElementById || !JSValueIsObject(context, getElementById)) + return 0; + JSValueRef elementIdValue = JSValueMakeString(context, elementId); + JSValueRef exception; + JSValueRef element = JSObjectCallAsFunction(context, const_cast<JSObjectRef>(getElementById), document, 1, &elementIdValue, &exception); + if (!element || !JSValueIsObject(context, element)) + return 0; + return const_cast<JSObjectRef>(element); } -LayoutTestController::LayoutTestController(const std::string& testPathOrURL) - : m_dumpAsText(false) +PassRefPtr<LayoutTestController> LayoutTestController::create() +{ + return adoptRef(new LayoutTestController); +} + +LayoutTestController::LayoutTestController() + : m_whatToDump(RenderTree) + , m_shouldDumpAllFrameScrollPositions(false) + , m_shouldAllowEditing(true) + , m_dumpEditingCallbacks(false) , m_dumpStatusCallbacks(false) , m_waitToDump(false) , m_testRepaint(false) , m_testRepaintSweepHorizontally(false) - , m_testPathOrURL(testPathOrURL) { } @@ -60,10 +133,6 @@ JSClassRef LayoutTestController::wrapperClass() return JSLayoutTestController::layoutTestControllerClass(); } -// This is lower than DumpRenderTree's timeout, to make it easier to work through the failures -// Eventually it should be changed to match. -static const CFTimeInterval waitToDumpWatchdogInterval = 6.0; - void LayoutTestController::display() { // FIXME: actually implement, once we want pixel tests @@ -109,27 +178,75 @@ void LayoutTestController::notifyDone() unsigned LayoutTestController::numberOfActiveAnimations() const { + // FIXME: Is it OK this works only for the main frame? + // FIXME: If this is needed only for the main frame, then why is the function on WKBundleFrame instead of WKBundlePage? WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); return WKBundleFrameGetNumberOfActiveAnimations(mainFrame); } bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) { - RetainPtr<CFStringRef> idCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId)); - WKRetainPtr<WKStringRef> idWK(AdoptWK, WKStringCreateWithCFString(idCF.get())); - RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, animationName)); - WKRetainPtr<WKStringRef> nameWK(AdoptWK, WKStringCreateWithCFString(nameCF.get())); + // FIXME: Is it OK this works only for the main frame? + // FIXME: If this is needed only for the main frame, then why is the function on WKBundleFrame instead of WKBundlePage? + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); + return WKBundleFramePauseAnimationOnElementWithId(mainFrame, toWK(animationName).get(), toWK(elementId).get(), time); +} +void LayoutTestController::keepWebHistory() +{ + InjectedBundle::shared().setShouldTrackVisitedLinks(); +} + +JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSValueRef element) +{ + // FIXME: Is it OK this works only for the main frame? WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); - return WKBundleFramePauseAnimationOnElementWithId(mainFrame, nameWK.get(), idWK.get(), time); + JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); + if (!JSValueIsObject(context, element)) + return JSValueMakeUndefined(context); + JSValueRef value = WKBundleFrameGetComputedStyleIncludingVisitedInfo(mainFrame, const_cast<JSObjectRef>(element)); + if (!value) + return JSValueMakeUndefined(context); + return value; +} + +JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef elementId) +{ + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); + JSObjectRef element = getElementById(mainFrame, elementId); + if (!element) + return 0; + WKRetainPtr<WKStringRef> value(AdoptWK, WKBundleFrameCopyCounterValue(mainFrame, const_cast<JSObjectRef>(element))); + return toJS(value); +} + +JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSValueRef element) +{ + WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page()); + JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); + if (!element || !JSValueIsObject(context, element)) + return 0; + WKRetainPtr<WKStringRef> text(AdoptWK, WKBundleFrameCopyMarkerText(mainFrame, const_cast<JSObjectRef>(element))); + if (WKStringIsEmpty(text.get())) + return 0; + return toJS(text); +} + +void LayoutTestController::execCommand(JSStringRef name, JSStringRef argument) +{ + WKBundlePageExecuteEditingCommand(InjectedBundle::shared().page()->page(), toWK(name).get(), toWK(argument).get()); +} + +bool LayoutTestController::isCommandEnabled(JSStringRef name) +{ + return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get()); } // Object Creation void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) { - JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController")); - JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), JSWrapper::wrap(context, this), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); + setProperty(context, windowObject, "layoutTestController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index f9585a3..9f0641b 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -28,6 +28,7 @@ #include "JSWrappable.h" #include <JavaScriptCore/JavaScriptCore.h> +#include <JavaScriptCore/JSRetainPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> #include <string> @@ -36,44 +37,73 @@ namespace WTR { class LayoutTestController : public JSWrappable { public: - static PassRefPtr<LayoutTestController> create(const std::string& testPathOrURL); - ~LayoutTestController(); + static PassRefPtr<LayoutTestController> create(); + virtual ~LayoutTestController(); // JSWrappable - JSClassRef wrapperClass(); + virtual JSClassRef wrapperClass(); - void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception); + void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception); - bool shouldDumpAsText() const { return m_dumpAsText; } - void dumpAsText() { m_dumpAsText = true; } + // The basics. + void dumpAsText() { m_whatToDump = MainFrameText; } + void dumpChildFramesAsText() { m_whatToDump = AllFramesText; } + void waitUntilDone(); + void notifyDone(); - bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } + // Other dumping. + void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; } + void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; } + void dumpSelectionRect() { } // Will need to do something when we support pixel tests. void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; } - bool waitToDump() const { return m_waitToDump; } - void waitToDumpWatchdogTimerFired(); - void invalidateWaitToDumpWatchdog(); - void waitUntilDone(); - void notifyDone(); + // Special options. + void keepWebHistory(); + void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; } + + // Special DOM functions. + JSValueRef computedStyleIncludingVisitedInfo(JSValueRef element); + JSRetainPtr<JSStringRef> counterValueForElementById(JSStringRef elementId); + JSRetainPtr<JSStringRef> markerTextForListItem(JSValueRef element); + void execCommand(JSStringRef name, JSStringRef argument); + bool isCommandEnabled(JSStringRef name); + // Repaint testing. void testRepaint() { m_testRepaint = true; } void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; } void display(); + // Animation testing. unsigned numberOfActiveAnimations() const; bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId); + enum WhatToDump { RenderTree, MainFrameText, AllFramesText }; + WhatToDump whatToDump() const { return m_whatToDump; } + + bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; } + bool shouldDumpEditingCallbacks() const { return m_dumpEditingCallbacks; } + bool shouldDumpMainFrameScrollPosition() const { return m_whatToDump == RenderTree; } + + bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; } + + bool waitToDump() const { return m_waitToDump; } + void waitToDumpWatchdogTimerFired(); + void invalidateWaitToDumpWatchdog(); + + bool shouldAllowEditing() const { return m_shouldAllowEditing; } + private: - LayoutTestController(const std::string& testPathOrURL); + LayoutTestController(); - bool m_dumpAsText; + WhatToDump m_whatToDump; + bool m_shouldDumpAllFrameScrollPositions; + bool m_shouldAllowEditing; + bool m_dumpEditingCallbacks; bool m_dumpStatusCallbacks; bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called. bool m_testRepaint; bool m_testRepaintSweepHorizontally; - std::string m_testPathOrURL; - RetainPtr<CFRunLoopTimerRef> m_waitToDumpWatchdog; }; diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj b/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj index 601a4ac..be20bab 100644 --- a/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/win/InjectedBundle.vcproj @@ -23,7 +23,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -39,8 +38,6 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -53,7 +50,6 @@ />
<Tool
Name="VCLinkerTool"
- OutputFile=""
/>
<Tool
Name="VCALinkTool"
@@ -78,7 +74,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -90,7 +85,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -106,8 +100,6 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -120,7 +112,6 @@ />
<Tool
Name="VCLinkerTool"
- OutputFile=""
/>
<Tool
Name="VCALinkTool"
@@ -145,7 +136,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -156,7 +146,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -172,9 +161,6 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- RuntimeLibrary="3"
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -187,7 +173,6 @@ />
<Tool
Name="VCLinkerTool"
- OutputFile=""
/>
<Tool
Name="VCALinkTool"
@@ -212,7 +197,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
<Configuration
@@ -223,7 +207,6 @@ >
<Tool
Name="VCPreBuildEventTool"
- CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
@@ -239,8 +222,6 @@ />
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- ForcedIncludeFiles=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -253,7 +234,6 @@ />
<Tool
Name="VCLinkerTool"
- OutputFile=""
/>
<Tool
Name="VCALinkTool"
@@ -278,7 +258,6 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine=""
/>
</Configuration>
</Configurations>
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp index fec6b56..4f8cd6b 100644 --- a/WebKitTools/WebKitTestRunner/TestController.cpp +++ b/WebKitTools/WebKitTestRunner/TestController.cpp @@ -82,7 +82,7 @@ void TestController::initialize(int argc, const char* argv[]) WKContextInjectedBundleClient injectedBundlePathClient = { 0, this, - _didRecieveMessageFromInjectedBundle + _didReceiveMessageFromInjectedBundle }; WKContextSetInjectedBundleClient(m_context.get(), &injectedBundlePathClient); @@ -126,14 +126,14 @@ bool TestController::run() return true; } -void TestController::_didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo) +void TestController::_didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void *clientInfo) { - static_cast<TestController*>(const_cast<void*>(clientInfo))->didRecieveMessageFromInjectedBundle(message); + static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(message); } -void TestController::didRecieveMessageFromInjectedBundle(WKStringRef message) +void TestController::didReceiveMessageFromInjectedBundle(WKStringRef message) { - m_currentInvocation->didRecieveMessageFromInjectedBundle(message); + m_currentInvocation->didReceiveMessageFromInjectedBundle(message); } } // namespace WTR diff --git a/WebKitTools/WebKitTestRunner/TestController.h b/WebKitTools/WebKitTestRunner/TestController.h index 7e829b6..bd073bf 100644 --- a/WebKitTools/WebKitTestRunner/TestController.h +++ b/WebKitTools/WebKitTestRunner/TestController.h @@ -67,8 +67,8 @@ private: void initializeTestPluginPath(); // WKContextInjectedBundleClient - static void _didRecieveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*); - void didRecieveMessageFromInjectedBundle(WKStringRef message); + static void _didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef message, const void*); + void didReceiveMessageFromInjectedBundle(WKStringRef message); OwnPtr<TestInvocation> m_currentInvocation; diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp index 1434d50..b6e950f 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp +++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp @@ -139,7 +139,7 @@ void TestInvocation::dump(const char* stringToDump) fflush(stderr); } -void TestInvocation::didRecieveMessageFromInjectedBundle(WKStringRef message) +void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef message) { RetainPtr<CFStringRef> cfMessage(AdoptCF, WKStringCopyCFString(0, message)); diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.h b/WebKitTools/WebKitTestRunner/TestInvocation.h index b5fc041..e064a8f 100644 --- a/WebKitTools/WebKitTestRunner/TestInvocation.h +++ b/WebKitTools/WebKitTestRunner/TestInvocation.h @@ -37,7 +37,7 @@ public: ~TestInvocation(); void invoke(); - void didRecieveMessageFromInjectedBundle(WKStringRef message); + void didReceiveMessageFromInjectedBundle(WKStringRef message); private: void dump(const char*); diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp index 232c396..987481a 100644 --- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp +++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp @@ -41,7 +41,7 @@ void TestController::initializeInjectedBundlePath() { CFStringRef exeContainerPath = CFURLCopyFileSystemPath(CFURLCreateCopyDeletingLastPathComponent(0, CFBundleCopyExecutableURL(CFBundleGetMainBundle())), kCFURLWindowsPathStyle); CFMutableStringRef bundlePath = CFStringCreateMutableCopy(0, 0, exeContainerPath); -#ifndef NDEBUG +#ifdef DEBUG_ALL CFStringAppendCString(bundlePath, "\\InjectedBundle_debug.dll", kCFStringEncodingWindowsLatin1); #else CFStringAppendCString(bundlePath, "\\InjectedBundle.dll", kCFStringEncodingWindowsLatin1); diff --git a/WebKitTools/gdb/wtf.py b/WebKitTools/gdb/wtf.py new file mode 100644 index 0000000..cf4b59b --- /dev/null +++ b/WebKitTools/gdb/wtf.py @@ -0,0 +1,133 @@ +# Copyright (C) 2010, Google 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: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * 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. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +# OWNER OR 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. + +"""GDB support for WebKit WTF types. + +Add this to your gdb by amending your ~/.gdbinit as follows: + python + import sys + sys.path.insert(0, "/path/to/tools/gdb/") + import wtf + +See http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html for GDB's +Python API. +""" + +import gdb +import re + + +class WTFVectorPrinter: + """Pretty Printer for a WTF::Vector. + + The output of this pretty printer is similar to the output of std::vector's + pretty printer, which is bundled in gcc. + + Example gdb session should look like: + (gdb) p v + $3 = WTF::Vector of length 7, capacity 16 = {7, 17, 27, 37, 47, 57, 67} + (gdb) set print elements 3 + (gdb) p v + $6 = WTF::Vector of length 7, capacity 16 = {7, 17, 27...} + (gdb) set print array + (gdb) p v + $7 = WTF::Vector of length 7, capacity 16 = { + 7, + 17, + 27 + ... + } + (gdb) set print elements 200 + (gdb) p v + $8 = WTF::Vector of length 7, capacity 16 = { + 7, + 17, + 27, + 37, + 47, + 57, + 67 + } + """ + + class Iterator: + def __init__(self, start, finish): + self.item = start + self.finish = finish + self.count = 0 + + def __iter__(self): + return self + + def next(self): + if self.item == self.finish: + raise StopIteration + count = self.count + self.count += 1 + element = self.item.dereference() + self.item += 1 + return ('[%d]' % count, element) + + def __init__(self, val): + self.val = val + + def children(self): + start = self.val['m_buffer']['m_buffer'] + return self.Iterator(start, start + self.val['m_size']) + + def to_string(self): + return ('%s of length %d, capacity %d' + % ('WTF::Vector', self.val['m_size'], self.val['m_buffer']['m_capacity'])) + + def display_hint(self): + return 'array' + + +def lookup_function(val): + type = val.type + if type.code == gdb.TYPE_CODE_REF: + type = type.target() + type = type.unqualified().strip_typedefs() + typename = type.tag + if not typename: + return None + for function, pretty_printer in pretty_printers_dict.items(): + if function.search(typename): + return pretty_printer(val) + return None + + +def build_pretty_printers_dict(): + pretty_printers_dict[re.compile('^WTF::Vector<.*>$')] = WTFVectorPrinter + + +pretty_printers_dict = {} + +build_pretty_printers_dict() + +gdb.pretty_printers.append(lookup_function) diff --git a/WebKitTools/wx/browser/wscript b/WebKitTools/wx/browser/wscript index a2a24e0..bd2640c 100644 --- a/WebKitTools/wx/browser/wscript +++ b/WebKitTools/wx/browser/wscript @@ -29,7 +29,8 @@ import sys from settings import * -include_paths = [os.path.join(wk_root, 'WebKit', 'wx')] +include_paths = [os.path.join(wk_root, 'WebCore', 'bindings', 'wx'), + os.path.join(wk_root, 'WebKit', 'wx')] def set_options(opt): common_set_options(opt) diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py index 122f93a..2d144f6 100644 --- a/WebKitTools/wx/build/settings.py +++ b/WebKitTools/wx/build/settings.py @@ -99,6 +99,7 @@ jscore_dirs = [ webcore_dirs = [ 'accessibility', 'bindings', + 'bindings/cpp', 'bindings/generic', 'bindings/js', 'bridge', @@ -168,7 +169,7 @@ def get_config(): waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL' else: waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL_DBG' - + return waf_configname create_hash_table = wk_root + "/JavaScriptCore/create_hash_table" @@ -176,7 +177,10 @@ if building_on_win32: create_hash_table = get_output('cygpath --unix "%s"' % create_hash_table) os.environ['CREATE_HASH_TABLE'] = create_hash_table -feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE', 'ENABLE_SVG_FOREIGN_OBJECT'] +feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', + 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', + 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE', 'ENABLE_SVG_FOREIGN_OBJECT', + 'ENABLE_JIT', 'ENABLE_EXECUTABLE_ALLOCATOR_DEMAND', 'BUILDING_%s' % build_port.upper()] msvc_version = 'msvc2008' |