Bug 163553 - Move internal testing classes from ExceptionCode to Exception
Summary: Move internal testing classes from ExceptionCode to Exception
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-17 11:12 PDT by Darin Adler
Modified: 2016-10-18 22:27 PDT (History)
6 users (show)

See Also:


Attachments
Patch (190.58 KB, patch)
2016-10-17 11:41 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-yosemite (1.06 MB, application/zip)
2016-10-17 12:48 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.41 MB, application/zip)
2016-10-17 12:53 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (1.69 MB, application/zip)
2016-10-17 12:56 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews126 for ios-simulator-wk2 (3.14 MB, application/zip)
2016-10-17 13:27 PDT, Build Bot
no flags Details
Patch (190.57 KB, patch)
2016-10-18 19:22 PDT, Darin Adler
rniwa: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (472.30 KB, application/zip)
2016-10-18 20:31 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2016-10-17 11:12:32 PDT
Move internal testing classes from ExceptionCode to Exception
Comment 1 Darin Adler 2016-10-17 11:41:24 PDT
Created attachment 291846 [details]
Patch
Comment 2 Build Bot 2016-10-17 12:48:05 PDT
Comment on attachment 291846 [details]
Patch

Attachment 291846 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2305974

New failing tests:
fast/shrink-wrap/rect-shrink-wrap.html
Comment 3 Build Bot 2016-10-17 12:48:09 PDT
Created attachment 291858 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 4 Build Bot 2016-10-17 12:53:52 PDT
Comment on attachment 291846 [details]
Patch

Attachment 291846 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2306008

New failing tests:
fast/shrink-wrap/rect-shrink-wrap.html
Comment 5 Build Bot 2016-10-17 12:53:55 PDT
Created attachment 291859 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 6 Build Bot 2016-10-17 12:56:34 PDT
Comment on attachment 291846 [details]
Patch

Attachment 291846 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2305956

New failing tests:
fast/shrink-wrap/rect-shrink-wrap.html
Comment 7 Build Bot 2016-10-17 12:56:37 PDT
Created attachment 291860 [details]
Archive of layout-test-results from ews114 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-10-17 13:27:02 PDT
Comment on attachment 291846 [details]
Patch

Attachment 291846 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2306181

Number of test failures exceeded the failure limit.
Comment 9 Build Bot 2016-10-17 13:27:05 PDT
Created attachment 291862 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 10 Darin Adler 2016-10-18 19:22:41 PDT
Created attachment 292026 [details]
Patch
Comment 11 Build Bot 2016-10-18 20:31:54 PDT
Comment on attachment 292026 [details]
Patch

Attachment 292026 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2320655

Number of test failures exceeded the failure limit.
Comment 12 Build Bot 2016-10-18 20:31:59 PDT
Created attachment 292031 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 13 Ryosuke Niwa 2016-10-18 21:36:24 PDT
Comment on attachment 292026 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292026&action=review

> Source/WebCore/dom/Element.cpp:1803
> -RefPtr<ShadowRoot> Element::createShadowRoot(ExceptionCode& ec)
> +ShadowRoot* Element::createShadowRoot(ExceptionCode& ec)

This seems rather unrelated. But why don't we change it to ExceptionOr<ShadowRoot*> while we're at it?

> Source/WebCore/testing/InternalSettings.cpp:375
> -    InternalSettingsGuardForSettings();
> +    INTERNAL_SETTINGS_GUARD

It's not obvious at all that this macro is returning an exception when m_page is null.
Can we rename it to something more descriptive like RETURN_EXCEPTION_IF_PAGE_IS_NULL?

One more idea (not that we should implement in this patch).

We could add some sort of extended IDL attribute e.g. ValidateAccess,
and then call a helper function that throws an exception automatically in the binding code.

e.g. In IDL:
[ValidateAccess] setCanStartMedia(boolean enabled);
then in C++,
ExceptionOr<void> validateAccess() { return m_page ? { } : INVALID_ACCESS_ERR; }
void setCanStartMedia(bool enabled);

I'm not sure if such an extended attribute will be useful in other IDL files though...

Or maybe we can just get rid of the marco and just have if (!m_page) return INVALID_ACCESS_ERR;
Honestly, I think two lines of extra code is okay given that it'll make the code much easier to understand.

> Source/WebCore/testing/InternalSettings.h:50
> +    void hostDestroyed() { m_page = nullptr; }

Do we really need to inline this?
Comment 14 Darin Adler 2016-10-18 22:05:07 PDT
Comment on attachment 292026 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292026&action=review

>> Source/WebCore/dom/Element.cpp:1803
>> +ShadowRoot* Element::createShadowRoot(ExceptionCode& ec)
> 
> This seems rather unrelated. But why don't we change it to ExceptionOr<ShadowRoot*> while we're at it?

Internals::ensureShadowRoot was the reason I touched this.

I promise to come back here and take care of converting to ExceptionOr. I don’t want to do just that one function in Element.cpp at this time.

>> Source/WebCore/testing/InternalSettings.cpp:375
>> +    INTERNAL_SETTINGS_GUARD
> 
> It's not obvious at all that this macro is returning an exception when m_page is null.
> Can we rename it to something more descriptive like RETURN_EXCEPTION_IF_PAGE_IS_NULL?
> 
> One more idea (not that we should implement in this patch).
> 
> We could add some sort of extended IDL attribute e.g. ValidateAccess,
> and then call a helper function that throws an exception automatically in the binding code.
> 
> e.g. In IDL:
> [ValidateAccess] setCanStartMedia(boolean enabled);
> then in C++,
> ExceptionOr<void> validateAccess() { return m_page ? { } : INVALID_ACCESS_ERR; }
> void setCanStartMedia(bool enabled);
> 
> I'm not sure if such an extended attribute will be useful in other IDL files though...
> 
> Or maybe we can just get rid of the marco and just have if (!m_page) return INVALID_ACCESS_ERR;
> Honestly, I think two lines of extra code is okay given that it'll make the code much easier to understand.

I agree about the two lines of code. I will get rid of the macro.

>> Source/WebCore/testing/InternalSettings.h:50
>> +    void hostDestroyed() { m_page = nullptr; }
> 
> Do we really need to inline this?

No.
Comment 15 Darin Adler 2016-10-18 22:27:52 PDT
Committed r207521: <http://trac.webkit.org/changeset/207521>