Buggy code:
static final String URI_FILEROOT = "file://////" ; static final String PROTOCOL_FILE = "file:////" ; static final String PROTOCOL_HTTP = "http:////" ; static final String ABOUT_BLANK = "about:blank" ; static final String HEADER_SETCOOKIE = "Set-Cookie" ; static final String POST = "POST" ; static final String USER_AGENT = "user-agent" ; static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget" ; static final String SAFARI_EVENTS_FIX_KEY = "org.eclipse.swt.internal.safariEventsFix" ; static final byte [ ] SWT_OBJECT = new byte [ ] { 'S' , 'W' , 'T' , '_' , 'O' , 'B' , 'J' , 'E' , 'C' , 'T' , '' } ; static final String DOMEVENT_KEYUP = "keyup" ; static final String DOMEVENT_KEYDOWN = "keydown" ; static final String DOMEVENT_MOUSEDOWN = "mousedown" ; static final String DOMEVENT_MOUSEUP = "mouseup" ; static final String DOMEVENT_MOUSEMOVE = "mousemove" ; static final String DOMEVENT_MOUSEWHEEL = "mousewheel" ; public void create ( Composite parent , int style ) { } public boolean back ( ) { } static int browserProc ( int id , int sel , int arg0 ) { } static int browserProc ( int id , int sel , int arg0 , int arg1 ) { } static int browserProc ( int id , int sel , int arg0 , int arg1 , int arg2 ) { } static int browserProc ( int id , int sel , int arg0 , int arg1 , int arg2 , int arg3 ) { } static int browserProc ( int id , int sel , int arg0 , int arg1 , int arg2 , int arg3 , int arg4 ) { } static boolean isSelectorExcludedFromWebScript ( int aSelector ) { } static int webScriptNameForSelector ( int aSelector ) { } public boolean close ( ) { } boolean close ( boolean showPrompters ) { } public boolean execute ( String script ) { } public boolean forward ( ) { } public String getBrowserType ( ) { } public String getText ( ) { } public String getUrl ( ) { } public boolean isBackEnabled ( ) { } public boolean isForwardEnabled ( ) { } public void refresh ( ) { } public boolean setText ( String html , boolean trusted ) { } public boolean setUrl ( String url , String postData , String [ ] headers ) { html = null ; if ( ( url . indexOf ( '//' ) ) == 0 ) { url = ( Safari . PROTOCOL_FILE ) + url ; } else if ( ( url . indexOf ( ':' ) ) == ( - 1 ) ) { url = ( Safari . PROTOCOL_HTTP ) + url ; } NSString str = NSString . stringWith ( url ) ; NSString unescapedStr = NSString . stringWith ( "%#" ) ; int ptr = OS . CFURLCreateStringByAddingPercentEscapes ( 0 , str . id , unescapedStr . id , 0 , kCFStringEncodingUTF8 ) ; NSString escapedString = new NSString ( ptr ) ; NSURL inURL = NSURL . URLWithString ( escapedString ) ; OS . CFRelease ( ptr ) ; NSMutableURLRequest request = ( ( NSMutableURLRequest ) ( NSMutableURLRequest . requestWithURL ( inURL ) ) ) ; if ( postData != null ) { request . setHTTPMethod ( NSString . stringWith ( Safari . POST ) ) ; byte [ ] bytes = postData . getBytes ( ) ; NSData data = NSData . dataWithBytes ( bytes , bytes . length ) ; request . setHTTPBody ( data ) ; } if ( headers != null ) { for ( int i = 0 ; i < ( headers . length ) ; i ++ ) { String current = headers [ i ] ; if ( current != null ) { int index = current . indexOf ( ':' ) ; if ( index != ( - 1 ) ) { String key = current . substring ( 0 , index ) . trim ( ) ; String value = current . substring ( ( index + 1 ) ) . trim ( ) ; if ( ( ( key . length ( ) ) > 0 ) && ( ( value . length ( ) ) > 0 ) ) { <START_BUG> if ( key . equals ( Safari . USER_AGENT ) ) { <END_BUG> webView . setCustomUserAgent ( NSString . stringWith ( value ) ) ; } else { request . setValue ( NSString . stringWith ( value ) , NSString . stringWith ( key ) ) ; } } } } } } WebFrame mainFrame = webView . mainFrame ( ) ; mainFrame . loadRequest ( request ) ; webView . setCustomUserAgent ( null ) ; return true ; } public void stop ( ) { } void webView_didChangeLocationWithinPageForFrame ( int sender , int frameID ) { } void webView_didFailProvisionalLoadWithError_forFrame ( int sender , int error , int frame ) { } void webView_didFinishLoadForFrame ( int sender , int frameID ) { } void hookDOMKeyListeners ( int frameID ) { } void hookDOMMouseListeners ( int frameID ) { } void webView_didReceiveTitle_forFrame ( int sender , int titleID , int frameID ) { } void webView_didStartProvisionalLoadForFrame ( int sender , int frameID ) { } void webView_didCommitLoadForFrame ( int sender , int frameID ) { } void webView_windowScriptObjectAvailable ( int webView , int windowScriptObject ) { } void webView_resource_didFinishLoadingFromDataSource ( int sender , int identifier , int dataSource ) { } void webView_resource_didFailLoadingWithError_fromDataSource ( int sender , int identifier , int error , int dataSource ) { } void webView_resource_didReceiveAuthenticationChallenge_fromDataSource ( int sender , int identifier , int challenge , int dataSource ) { } boolean showAuthenticationDialog ( final String [ ] user , final String [ ] password , String host , String realm ) { } int webView_identifierForInitialRequest_fromDataSource ( int sender , int request , int dataSourceID ) { } int webView_resource_willSendRequest_redirectResponse_fromDataSource ( int sender , int identifier , int request , int redirectResponse , int dataSource ) { }

Fix:
if ( key . equalsIgnoreCase ( Safari . USER_AGENT ) ) {