In webviews, Look Up feature breaks scrolling and JavaScript, affects styles

Originator:violasong
Number:rdar://9788953 Date Originated:16-Jul-2011
Status:Open Resolved:
Product:Mac OS X Product Version:10.7 (Build 11A480E)
Classification:Serious Bug Reproducible:Always
 
Summary:

In standard Cocoa webviews, if you use the standard "look up" service to define a word, the scrollbars (if present) disappear, scrolling is broken, all JavaScript no longer works, and the web page's style is affected.

Steps to Reproduce:

1. Build and Run this app: http://dl.dropbox.com/u/55342/radar/NoCodeBrowser.zip (It's a trivial "web browser" app made with Interface Builder, no code. It simply has a webview and a textfield that is bound to the webview's takeStringURLFrom: action.)
2. In the text field, enter this address: http://dl.dropbox.com/u/55342/radar/javascript_test.html
3. Note that you can scroll the page, and click the "Test JavaScript" button to display the current date/time. Also note that the font of the text is Times.
3. Select a word (such as "JavaScript"), right click, and select Look Up "JavaScript."

Expected Results:

Dictionary popover appears, but the page is not affected.

Actual Results:

1. Dictionary popover appears.
3. The scrollbars disappear.
4. I am no longer able to scroll the page.
4. The "Test JavaScript" button no longer works.
5. The font of the web page changes from Times to Baskerville. (The same font as the one used in the Dictionary Popover.)

Regression:

Doesn't happen in 10.6.6.

Notes:

Perhaps has something to do with the webview's page being overridden by code in the dictionary popover.

Comments

Workaround

Specify a non-empty preferences identifier on the WebView, either via Interface Builder's "Identifier" field or using -[WebView setPreferencesIdentifier:]. Thanks bdash!


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!