Bug 174736 - REGRESSION(r204565): WKObject is broken
Summary: REGRESSION(r204565): WKObject is broken
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 160938
  Show dependency treegraph
 
Reported: 2017-07-21 16:25 PDT by Chris Dumez
Modified: 2017-07-22 10:32 PDT (History)
8 users (show)

See Also:


Attachments
WIP Patch (does not work) (7.62 KB, patch)
2017-07-21 16:27 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (does not work) (7.84 KB, patch)
2017-07-21 16:38 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (Needs API test) (7.40 KB, patch)
2017-07-21 16:52 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (350.35 KB, application/zip)
2017-07-21 17:53 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (963.69 KB, application/zip)
2017-07-21 17:59 PDT, Build Bot
no flags Details
Patch (11.97 KB, patch)
2017-07-21 22:16 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-07-21 16:25:12 PDT
REGRESSION(r204565): WKObject is broken.
Comment 1 Chris Dumez 2017-07-21 16:25:32 PDT
<rdar://problem/33246169>
Comment 2 Chris Dumez 2017-07-21 16:27:43 PDT
Created attachment 316139 [details]
WIP Patch (does not work)
Comment 3 Chris Dumez 2017-07-21 16:38:29 PDT
Created attachment 316140 [details]
WIP Patch (does not work)
Comment 4 Chris Dumez 2017-07-21 16:52:47 PDT
Created attachment 316143 [details]
WIP Patch (Needs API test)
Comment 5 Build Bot 2017-07-21 17:52:59 PDT
Comment on attachment 316143 [details]
WIP Patch (Needs API test)

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

Number of test failures exceeded the failure limit.
Comment 6 Build Bot 2017-07-21 17:53:00 PDT
Created attachment 316151 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 7 Build Bot 2017-07-21 17:59:17 PDT
Comment on attachment 316143 [details]
WIP Patch (Needs API test)

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

New failing tests:
imported/w3c/IndexedDB-private-browsing/idbfactory_open12.html
Comment 8 Build Bot 2017-07-21 17:59:19 PDT
Created attachment 316154 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 9 Geoffrey Garen 2017-07-21 18:16:24 PDT
Comment on attachment 316143 [details]
WIP Patch (Needs API test)

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

> Source/WebKit/Shared/Cocoa/WKObject.mm:33
> +@interface NSObject ()

I think maybe this is supposed to be @interface NSProxy or @interface WKObject.

Do we even need this declaration at all? We need to implement these methods because they're called at runtime, but I don't think we need to declare them for anyone's direct benefit.
Comment 10 Geoffrey Garen 2017-07-21 18:17:12 PDT
Comment on attachment 316143 [details]
WIP Patch (Needs API test)

r- to release the EWS bot from eternal crash-i-tude.
Comment 11 Chris Dumez 2017-07-21 18:30:29 PDT
(In reply to Geoffrey Garen from comment #9)
> Comment on attachment 316143 [details]
> WIP Patch (Needs API test)
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=316143&action=review
> 
> > Source/WebKit/Shared/Cocoa/WKObject.mm:33
> > +@interface NSObject ()
> 
> I think maybe this is supposed to be @interface NSProxy or @interface
> WKObject.
> 
> Do we even need this declaration at all? We need to implement these methods
> because they're called at runtime, but I don't think we need to declare them
> for anyone's direct benefit.

I will double check but I am pretty sure I got compiling errors without it because this is NSObject SPI.
Comment 12 Chris Dumez 2017-07-21 18:31:48 PDT
(In reply to Chris Dumez from comment #11)
> (In reply to Geoffrey Garen from comment #9)
> > Comment on attachment 316143 [details]
> > WIP Patch (Needs API test)
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=316143&action=review
> > 
> > > Source/WebKit/Shared/Cocoa/WKObject.mm:33
> > > +@interface NSObject ()
> > 
> > I think maybe this is supposed to be @interface NSProxy or @interface
> > WKObject.
> > 
> > Do we even need this declaration at all? We need to implement these methods
> > because they're called at runtime, but I don't think we need to declare them
> > for anyone's direct benefit.
> 
> I will double check but I am pretty sure I got compiling errors without it
> because this is NSObject SPI.

We call these on target, which is an NSObject so it looks correct to me.
Comment 13 Chris Dumez 2017-07-21 20:55:48 PDT
Assertion hits in debug look like so:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.JavaScriptCore      	0x000000010a3bb467 WTFCrash + 39 (Assertions.cpp:278)
1   com.apple.WebKit              	0x000000010d09bc5f API::Object::unwrap(void*) + 111 (APIObject.mm:337)
2   com.apple.WebKit              	0x000000010d1d3045 API::String* WebKit::toImpl<OpaqueWKString const*, API::String>(OpaqueWKString const*) + 21 (WKSharedAPICast.h:133)
3   com.apple.WebKit              	0x000000010dc6f875 WKStringGetMaximumUTF8CStringSize + 21 (WKString.cpp:70)
4   DumpRenderTree                	0x0000000108942260 dumpFramesAsText(WebFrame*) + 384 (DumpRenderTree.mm:1491)
5   DumpRenderTree                	0x0000000108941b36 dump() + 374 (DumpRenderTree.mm:1699)
6   DumpRenderTree                	0x0000000108960812 -[FrameLoadDelegate webView:locationChangeDone:forDataSource:] + 210 (FrameLoadDelegate.mm:169)
7   DumpRenderTree                	0x0000000108961233 -[FrameLoadDelegate webView:didFinishLoadForFrame:] + 419 (FrameLoadDelegate.mm:261)
8   com.apple.WebKitLegacy        	0x000000011c681a1e objc_object* wtfCallIMP<objc_object*, WebView*, objc_object*>(void (*)(), objc_object*, objc_selector*, WebView*, objc_object*) + 62 (ObjcRuntimeExtras.h:44)

I believe this is:
ASSERT([(id)object conformsToProtocol:@protocol(WKObject)]);

in API::Object* Object::unwrap(void* object).
Comment 14 mitz 2017-07-21 21:17:25 PDT
(In reply to Chris Dumez from comment #13)
> Assertion hits in debug look like so:
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   com.apple.JavaScriptCore      	0x000000010a3bb467 WTFCrash + 39
> (Assertions.cpp:278)
> 1   com.apple.WebKit              	0x000000010d09bc5f
> API::Object::unwrap(void*) + 111 (APIObject.mm:337)
> 2   com.apple.WebKit              	0x000000010d1d3045 API::String*
> WebKit::toImpl<OpaqueWKString const*, API::String>(OpaqueWKString const*) +
> 21 (WKSharedAPICast.h:133)
> 3   com.apple.WebKit              	0x000000010dc6f875
> WKStringGetMaximumUTF8CStringSize + 21 (WKString.cpp:70)
> 4   DumpRenderTree                	0x0000000108942260
> dumpFramesAsText(WebFrame*) + 384 (DumpRenderTree.mm:1491)
> 5   DumpRenderTree                	0x0000000108941b36 dump() + 374
> (DumpRenderTree.mm:1699)
> 6   DumpRenderTree                	0x0000000108960812 -[FrameLoadDelegate
> webView:locationChangeDone:forDataSource:] + 210 (FrameLoadDelegate.mm:169)
> 7   DumpRenderTree                	0x0000000108961233 -[FrameLoadDelegate
> webView:didFinishLoadForFrame:] + 419 (FrameLoadDelegate.mm:261)
> 8   com.apple.WebKitLegacy        	0x000000011c681a1e objc_object*
> wtfCallIMP<objc_object*, WebView*, objc_object*>(void (*)(), objc_object*,
> objc_selector*, WebView*, objc_object*) + 62 (ObjcRuntimeExtras.h:44)
> 
> I believe this is:
> ASSERT([(id)object conformsToProtocol:@protocol(WKObject)]);
> 
> in API::Object* Object::unwrap(void* object).

I suppose we could just drop the assertion (and the one that immediately follows it, which we’re probably also going to fail with the patch). If we get a non-<WKObject> there it will be pretty obvious when it fails to respond to -_apiObject.
Comment 15 Chris Dumez 2017-07-21 21:32:48 PDT
Trying to write an API test for this.
Comment 16 Chris Dumez 2017-07-21 22:16:27 PDT
Created attachment 316172 [details]
Patch
Comment 17 WebKit Commit Bot 2017-07-22 10:32:00 PDT
Comment on attachment 316172 [details]
Patch

Clearing flags on attachment: 316172

Committed r219764: <http://trac.webkit.org/changeset/219764>
Comment 18 WebKit Commit Bot 2017-07-22 10:32:02 PDT
All reviewed patches have been landed.  Closing bug.