[Webkit-unassigned] [Bug 32694] New: WebKitLinkedOnOrAfter() ignores embedded frameworks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 17 19:50:23 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=32694

           Summary: WebKitLinkedOnOrAfter() ignores embedded frameworks
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: opendarwin at lapcatsoftware.com


Created an attachment (id=45122)
 --> (https://bugs.webkit.org/attachment.cgi?id=45122)
Sample Xcode project

Overview:
WebKit uses the function WebKitLinkedOnOrAfter(), defined in
WebKit/mac/Misc/WebKitVersionChecks.m, to check the version of WebKit that an
app is linked to. WebKitLinkedOnOrAfter() in turn calls
NSVersionOfLinkTimeLibrary("WebKit"). However, NSVersionOfLinkTimeLibrary()
only checks the main executable, and it returns -1 if the main executable did
not link against the specified library. If you have an app that does not link
to WebKit but that embeds a framework that does link to WebKit,
NSVersionOfLinkTimeLibrary("WebKit") will return -1, but WebKit fails to check
for that return value, and thus the value of WebKitLinkedOnOrAfter() has an
unexpected result.

The unexpected result of WebKitLinkedOnOrAfter() can lead to undesired
behavior. For example, I discovered this bug because the WebUIDelegate method
webView:contextMenuItemsForElement:defaultMenuItems: wasn't getting called when
right-clicking in a text field. This is because in the file
WebKit/mac/WebCoreSupport/WebContextMenuClient.mm, there is a function
isPreVersion3Client() with the following code:

    static BOOL preVersion3Client =
!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_3_0_CONTEXT_MENU_TAGS);

If the app does not link to WebKit but an embedded framework does,
preVersion3Client gets the wrong value, YES. The result is that the wrong code
is run in WebContextMenuClient::getCustomMenuFromDefaultItems(), and the
WebUIDelegate method never gets called.

This bug is important because it is a common situation for embedded frameworks
to contain WebKit code. For example, the popular software updater Sparkle run
WebKit code. A lot of applications use Sparkle, but the applications themselves
may not link to WebKit. Our suite of applications embed a framework that runs
WebKit code for several purposes, such as showing a support contact form to the
user. Again, the app itself may not link to WebKit.


Steps to reproduce:
1) Download, unzip, build, and run the attached sample Xcode project
WebKitLinkBug.
2) Right-click in the "Last name" field.


Expected results:
The WebUIDelgate method webView:contextMenuItemsForElement:defaultMenuItems:
gets called, returns an empty NSArray, and no contextual menu pops up.


Actual results:
The WebUIDelgate method webView:contextMenuItemsForElement:defaultMenuItems:
doesn't get called, and a contextual menu containing default items pops up.


Regression:
This bug occurs on Max OS X 10.6.2 and Mac OS X 10.5.8. It also occurs with
WebKit svn revision 51668 built from source.


Notes:
You can see in the console log when
webView:contextMenuItemsForElement:defaultMenuItems: gets called. You can also
see that NSVersionOfLinkTimeLibrary("WebKit") returns -1. However, if you go
back into the WebKitLinkBug project, and link the WebKitLinkBug target to
WebKit, then the bug does not occur, and NSVersionOfLinkTimeLibrary("WebKit")
returns 34801920.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list