UIScriptController: setting a callback to undefined should unregister it
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2016 00:23:36 +0000 (00:23 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2016 00:23:36 +0000 (00:23 +0000)
commit95a837c693431bac6a1ad55081d6b128b90727fe
tree61c68a3735772b1e0c7434c792f37f7298161f9f
parentf4e15ab313fe5b4271dff3c6d8c24b2239cf7bb8
UIScriptController: setting a callback to undefined should unregister it
https://bugs.webkit.org/show_bug.cgi?id=164796

Reviewed by Dean Jackson.
Tools:

"Immediate" UI scripts (those that don't schedule any async tasks) should return
immediately, without the need to call uiScriptComplete(). However, this is broken if
an earlier UI script registered a callback (since no-one clears that callback after the
first script completes).

Make possible the workaround of setting the callback to undefined, which previously did
not clear the callback registration.

* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::registerCallback):
* TestRunnerShared/UIScriptContext/UIScriptContext.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::platformClearAllCallbacks):

LayoutTests:

* fast/harness/ui-side-script-unregister-callback-expected.txt: Added.
* fast/harness/ui-side-script-unregister-callback.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208769 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt [new file with mode: 0644]
LayoutTests/fast/harness/ui-side-script-unregister-callback.html [new file with mode: 0644]
Tools/ChangeLog
Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp
Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm