Program: 2274
Project: 2274
Buggy source:
@Override public void handleMessage(Message msg){
  if (messagesBlocked())   return;
switch (msg.what) {
case PAGE_STARTED:
    String startedUrl=msg.getData().getString("String_Node_Str");
  mWebView.onPageStarted(startedUrl);
if (mWebViewClient != null) {
  mWebViewClient.onPageStarted(mWebView.getWebView(),startedUrl,(Bitmap)msg.obj);
}
break;
case PAGE_FINISHED:
String finishedUrl=(String)msg.obj;
mWebView.onPageFinished(finishedUrl);
if (mWebViewClient != null) {
mWebViewClient.onPageFinished(mWebView.getWebView(),finishedUrl);
}
break;
case RECEIVED_ICON:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedIcon(mWebView.getWebView(),(Bitmap)msg.obj);
}
break;
case RECEIVED_TOUCH_ICON_URL:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedTouchIconUrl(mWebView.getWebView(),(String)msg.obj,msg.arg1 == 1);
}
break;
case RECEIVED_TITLE:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedTitle(mWebView.getWebView(),(String)msg.obj);
}
break;
case REPORT_ERROR:
if (mWebViewClient != null) {
int reasonCode=msg.arg1;
final String description=msg.getData().getString("String_Node_Str");
final String failUrl=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedError(mWebView.getWebView(),reasonCode,description,failUrl);
}
break;
case RESEND_POST_DATA:
Message resend=(Message)msg.getData().getParcelable("String_Node_Str");
Message dontResend=(Message)msg.getData().getParcelable("String_Node_Str");
if (mWebViewClient != null) {
mWebViewClient.onFormResubmission(mWebView.getWebView(),dontResend,resend);
}
 else {
dontResend.sendToTarget();
}
break;
case OVERRIDE_URL:
String overrideUrl=msg.getData().getString("String_Node_Str");
boolean override=uiOverrideUrlLoading(overrideUrl);
ResultTransport<Boolean> result=(ResultTransport<Boolean>)msg.obj;
synchronized (this) {
result.setResult(override);
notify();
}
break;
case AUTH_REQUEST:
if (mWebViewClient != null) {
HttpAuthHandler handler=(HttpAuthHandler)msg.obj;
String host=msg.getData().getString("String_Node_Str");
String realm=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedHttpAuthRequest(mWebView.getWebView(),handler,host,realm);
}
break;
case SSL_ERROR:
if (mWebViewClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
mWebViewClient.onReceivedSslError(mWebView.getWebView(),(SslErrorHandler)map.get("String_Node_Str"),(SslError)map.get("String_Node_Str"));
}
break;
case PROCEEDED_AFTER_SSL_ERROR:
if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) {
((WebViewClientClassicExt)mWebViewClient).onProceededAfterSslError(mWebView.getWebView(),(SslError)msg.obj);
}
break;
case CLIENT_CERT_REQUEST:
if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
((WebViewClientClassicExt)mWebViewClient).onReceivedClientCertRequest(mWebView.getWebView(),(ClientCertRequestHandler)map.get("String_Node_Str"),(String)map.get("String_Node_Str"));
}
break;
case PROGRESS:
synchronized (this) {
if (mWebChromeClient != null) {
mWebChromeClient.onProgressChanged(mWebView.getWebView(),mLatestProgress);
}
mProgressUpdatePending=false;
}
break;
case UPDATE_VISITED:
if (mWebViewClient != null) {
mWebViewClient.doUpdateVisitedHistory(mWebView.getWebView(),(String)msg.obj,msg.arg1 != 0);
}
break;
case LOAD_RESOURCE:
if (mWebViewClient != null) {
mWebViewClient.onLoadResource(mWebView.getWebView(),(String)msg.obj);
}
break;
case DOWNLOAD_FILE:
if (mDownloadListener != null) {
String url=msg.getData().getString("String_Node_Str");
String userAgent=msg.getData().getString("String_Node_Str");
String contentDisposition=msg.getData().getString("String_Node_Str");
String mimetype=msg.getData().getString("String_Node_Str");
String referer=msg.getData().getString("String_Node_Str");
Long contentLength=msg.getData().getLong("String_Node_Str");
if (mDownloadListener instanceof BrowserDownloadListener) {
((BrowserDownloadListener)mDownloadListener).onDownloadStart(url,userAgent,contentDisposition,mimetype,referer,contentLength);
}
 else {
mDownloadListener.onDownloadStart(url,userAgent,contentDisposition,mimetype,contentLength);
}
}
break;
case CREATE_WINDOW:
if (mWebChromeClient != null) {
if (!mWebChromeClient.onCreateWindow(mWebView.getWebView(),msg.arg1 == 1,msg.arg2 == 1,(Message)msg.obj)) {
synchronized (this) {
notify();
}
}
mWebView.dismissZoomControl();
}
break;
case REQUEST_FOCUS:
if (mWebChromeClient != null) {
mWebChromeClient.onRequestFocus(mWebView.getWebView());
}
break;
case CLOSE_WINDOW:
if (mWebChromeClient != null) {
mWebChromeClient.onCloseWindow(((WebViewClassic)msg.obj).getWebView());
}
break;
case SAVE_PASSWORD:
Bundle bundle=msg.getData();
String schemePlusHost=bundle.getString("String_Node_Str");
String username=bundle.getString("String_Node_Str");
String password=bundle.getString("String_Node_Str");
if (!mWebView.onSavePassword(schemePlusHost,username,password,(Message)msg.obj)) {
synchronized (this) {
notify();
}
}
break;
case ASYNC_KEYEVENTS:
if (mWebViewClient != null) {
mWebViewClient.onUnhandledKeyEvent(mWebView.getWebView(),(KeyEvent)msg.obj);
}
break;
case EXCEEDED_DATABASE_QUOTA:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
String databaseIdentifier=(String)map.get("String_Node_Str");
String url=(String)map.get("String_Node_Str");
long quota=((Long)map.get("String_Node_Str")).longValue();
long totalQuota=((Long)map.get("String_Node_Str")).longValue();
long estimatedDatabaseSize=((Long)map.get("String_Node_Str")).longValue();
WebStorage.QuotaUpdater quotaUpdater=(WebStorage.QuotaUpdater)map.get("String_Node_Str");
mWebChromeClient.onExceededDatabaseQuota(url,databaseIdentifier,quota,estimatedDatabaseSize,totalQuota,quotaUpdater);
}
break;
case REACHED_APPCACHE_MAXSIZE:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
long requiredStorage=((Long)map.get("String_Node_Str")).longValue();
long quota=((Long)map.get("String_Node_Str")).longValue();
WebStorage.QuotaUpdater quotaUpdater=(WebStorage.QuotaUpdater)map.get("String_Node_Str");
mWebChromeClient.onReachedMaxAppCacheSize(requiredStorage,quota,quotaUpdater);
}
break;
case GEOLOCATION_PERMISSIONS_SHOW_PROMPT:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
String origin=(String)map.get("String_Node_Str");
GeolocationPermissions.Callback callback=(GeolocationPermissions.Callback)map.get("String_Node_Str");
mWebChromeClient.onGeolocationPermissionsShowPrompt(origin,callback);
}
break;
case GEOLOCATION_PERMISSIONS_HIDE_PROMPT:
if (mWebChromeClient != null) {
mWebChromeClient.onGeolocationPermissionsHidePrompt();
}
break;
case JS_ALERT:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsResult res=receiver.mJsResult;
String message=msg.getData().getString("String_Node_Str");
String url=msg.getData().getString("String_Node_Str");
if (!mWebChromeClient.onJsAlert(mWebView.getWebView(),url,message,res)) {
if (!canShowAlertDialog()) {
res.cancel();
receiver.setReady();
break;
}
new AlertDialog.Builder(mContext).setTitle(getJsDialogTitle(url)).setMessage(message).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
res.confirm();
}
}
).setOnCancelListener(new DialogInterface.OnCancelListener(){
public void onCancel(DialogInterface dialog){
res.cancel();
}
}
).show();
}
receiver.setReady();
}
break;
case JS_CONFIRM:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsResult res=receiver.mJsResult;
String message=msg.getData().getString("String_Node_Str");
String url=msg.getData().getString("String_Node_Str");
if (!mWebChromeClient.onJsConfirm(mWebView.getWebView(),url,message,res)) {
if (!canShowAlertDialog()) {
res.cancel();
receiver.setReady();
break;
}
new AlertDialog.Builder(mContext).setTitle(getJsDialogTitle(url)).setMessage(message).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
res.confirm();
}
}
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
res.cancel();
}
}
).setOnCancelListener(new DialogInterface.OnCancelListener(){
public void onCancel(DialogInterface dialog){
res.cancel();
}
}
).show();
}
receiver.setReady();
}
break;
case JS_PROMPT:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsPromptResult res=receiver.mJsResult;
String message=msg.getData().getString("String_Node_Str");
String defaultVal=msg.getData().getString("String_Node_Str");
String url=msg.getData().getString("String_Node_Str");
if (!mWebChromeClient.onJsPrompt(mWebView.getWebView(),url,message,defaultVal,res)) {
if (!canShowAlertDialog()) {
res.cancel();
receiver.setReady();
break;
}
final LayoutInflater factory=LayoutInflater.from(mContext);
final View view=factory.inflate(R.layout.js_prompt,null);
final EditText v=(EditText)view.findViewById(R.id.value);
v.setText(defaultVal);
((TextView)view.findViewById(R.id.message)).setText(message);
new AlertDialog.Builder(mContext).setTitle(getJsDialogTitle(url)).setView(view).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
res.confirm(v.getText().toString());
}
}
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int whichButton){
res.cancel();
}
}
).setOnCancelListener(new DialogInterface.OnCancelListener(){
public void onCancel(DialogInterface dialog){
res.cancel();
}
}
).show();
}
receiver.setReady();
}
break;
case JS_UNLOAD:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsResult res=receiver.mJsResult;
String message=msg.getData().getString("String_Node_Str");
String url=msg.getData().getString("String_Node_Str");
if (!mWebChromeClient.onJsBeforeUnload(mWebView.getWebView(),url,message,res)) {
if (!canShowAlertDialog()) {
res.cancel();
receiver.setReady();
break;
}
final String m=mContext.getString(R.string.js_dialog_before_unload,message);
new AlertDialog.Builder(mContext).setMessage(m).setPositiveButton(R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
res.confirm();
}
}
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
res.cancel();
}
}
).setOnCancelListener(new DialogInterface.OnCancelListener(){
@Override public void onCancel(DialogInterface dialog){
res.cancel();
}
}
).show();
}
receiver.setReady();
}
break;
case JS_TIMEOUT:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsResult res=receiver.mJsResult;
if (mWebChromeClient.onJsTimeout()) {
res.confirm();
}
 else {
res.cancel();
}
receiver.setReady();
}
break;
case RECEIVED_CERTIFICATE:
mWebView.setCertificate((SslCertificate)msg.obj);
break;
case NOTIFY:
synchronized (this) {
notify();
}
break;
case SCALE_CHANGED:
if (mWebViewClient != null) {
mWebViewClient.onScaleChanged(mWebView.getWebView(),msg.getData().getFloat("String_Node_Str"),msg.getData().getFloat("String_Node_Str"));
}
break;
case SWITCH_OUT_HISTORY:
mWebView.switchOutDrawHistory();
break;
case ADD_MESSAGE_TO_CONSOLE:
if (mWebChromeClient == null) {
break;
}
String message=msg.getData().getString("String_Node_Str");
String sourceID=msg.getData().getString("String_Node_Str");
int lineNumber=msg.getData().getInt("String_Node_Str");
int msgLevel=msg.getData().getInt("String_Node_Str");
int numberOfMessageLevels=ConsoleMessage.MessageLevel.values().length;
if (msgLevel < 0 || msgLevel >= numberOfMessageLevels) {
msgLevel=0;
}
ConsoleMessage.MessageLevel messageLevel=ConsoleMessage.MessageLevel.values()[msgLevel];
if (!mWebChromeClient.onConsoleMessage(new ConsoleMessage(message,sourceID,lineNumber,messageLevel))) {
String logTag="String_Node_Str";
String logMessage=message + "String_Node_Str" + sourceID+ "String_Node_Str"+ lineNumber;
switch (messageLevel) {
case TIP:
Log.v(logTag,logMessage);
break;
case LOG:
Log.i(logTag,logMessage);
break;
case WARNING:
Log.w(logTag,logMessage);
break;
case ERROR:
Log.e(logTag,logMessage);
break;
case DEBUG:
Log.d(logTag,logMessage);
break;
}
}
break;
case GET_VISITED_HISTORY:
if (mWebChromeClient != null) {
mWebChromeClient.getVisitedHistory((ValueCallback<String[]>)msg.obj);
}
break;
case OPEN_FILE_CHOOSER:
if (mWebChromeClient != null) {
UploadFileMessageData data=(UploadFileMessageData)msg.obj;
mWebChromeClient.openFileChooser(data.getUploadFile(),data.getAcceptType(),data.getCapture());
}
break;
case ADD_HISTORY_ITEM:
if (mWebBackForwardListClient != null) {
mWebBackForwardListClient.onNewHistoryItem((WebHistoryItem)msg.obj);
}
break;
case HISTORY_INDEX_CHANGED:
if (mWebBackForwardListClient != null) {
mWebBackForwardListClient.onIndexChanged((WebHistoryItem)msg.obj,msg.arg1);
}
break;
case AUTH_CREDENTIALS:
{
String host=msg.getData().getString("String_Node_Str");
String realm=msg.getData().getString("String_Node_Str");
username=msg.getData().getString("String_Node_Str");
password=msg.getData().getString("String_Node_Str");
mWebView.setHttpAuthUsernamePassword(host,realm,username,password);
break;
}
case AUTO_LOGIN:
{
if (mWebViewClient != null) {
String realm=msg.getData().getString("String_Node_Str");
String account=msg.getData().getString("String_Node_Str");
String args=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedLoginRequest(mWebView.getWebView(),realm,account,args);
}
break;
}
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (messagesBlocked())   return;
switch (msg.what) {
case PAGE_STARTED:
    String startedUrl=msg.getData().getString("String_Node_Str");
  mWebView.onPageStarted(startedUrl);
if (mWebViewClient != null) {
  mWebViewClient.onPageStarted(mWebView.getWebView(),startedUrl,(Bitmap)msg.obj);
}
break;
case PAGE_FINISHED:
String finishedUrl=(String)msg.obj;
mWebView.onPageFinished(finishedUrl);
if (mWebViewClient != null) {
mWebViewClient.onPageFinished(mWebView.getWebView(),finishedUrl);
}
break;
case RECEIVED_ICON:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedIcon(mWebView.getWebView(),(Bitmap)msg.obj);
}
break;
case RECEIVED_TOUCH_ICON_URL:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedTouchIconUrl(mWebView.getWebView(),(String)msg.obj,msg.arg1 == 1);
}
break;
case RECEIVED_TITLE:
if (mWebChromeClient != null) {
mWebChromeClient.onReceivedTitle(mWebView.getWebView(),(String)msg.obj);
}
break;
case REPORT_ERROR:
if (mWebViewClient != null) {
int reasonCode=msg.arg1;
final String description=msg.getData().getString("String_Node_Str");
final String failUrl=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedError(mWebView.getWebView(),reasonCode,description,failUrl);
}
break;
case RESEND_POST_DATA:
Message resend=(Message)msg.getData().getParcelable("String_Node_Str");
Message dontResend=(Message)msg.getData().getParcelable("String_Node_Str");
if (mWebViewClient != null) {
mWebViewClient.onFormResubmission(mWebView.getWebView(),dontResend,resend);
}
 else {
dontResend.sendToTarget();
}
break;
case OVERRIDE_URL:
String overrideUrl=msg.getData().getString("String_Node_Str");
boolean override=uiOverrideUrlLoading(overrideUrl);
ResultTransport<Boolean> result=(ResultTransport<Boolean>)msg.obj;
synchronized (this) {
result.setResult(override);
notify();
}
break;
case AUTH_REQUEST:
if (mWebViewClient != null) {
HttpAuthHandler handler=(HttpAuthHandler)msg.obj;
String host=msg.getData().getString("String_Node_Str");
String realm=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedHttpAuthRequest(mWebView.getWebView(),handler,host,realm);
}
break;
case SSL_ERROR:
if (mWebViewClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
mWebViewClient.onReceivedSslError(mWebView.getWebView(),(SslErrorHandler)map.get("String_Node_Str"),(SslError)map.get("String_Node_Str"));
}
break;
case PROCEEDED_AFTER_SSL_ERROR:
if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) {
((WebViewClientClassicExt)mWebViewClient).onProceededAfterSslError(mWebView.getWebView(),(SslError)msg.obj);
}
break;
case CLIENT_CERT_REQUEST:
if (mWebViewClient != null && mWebViewClient instanceof WebViewClientClassicExt) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
((WebViewClientClassicExt)mWebViewClient).onReceivedClientCertRequest(mWebView.getWebView(),(ClientCertRequestHandler)map.get("String_Node_Str"),(String)map.get("String_Node_Str"));
}
break;
case PROGRESS:
synchronized (this) {
if (mWebChromeClient != null) {
mWebChromeClient.onProgressChanged(mWebView.getWebView(),mLatestProgress);
}
mProgressUpdatePending=false;
}
break;
case UPDATE_VISITED:
if (mWebViewClient != null) {
mWebViewClient.doUpdateVisitedHistory(mWebView.getWebView(),(String)msg.obj,msg.arg1 != 0);
}
break;
case LOAD_RESOURCE:
if (mWebViewClient != null) {
mWebViewClient.onLoadResource(mWebView.getWebView(),(String)msg.obj);
}
break;
case DOWNLOAD_FILE:
if (mDownloadListener != null) {
String url=msg.getData().getString("String_Node_Str");
String userAgent=msg.getData().getString("String_Node_Str");
String contentDisposition=msg.getData().getString("String_Node_Str");
String mimetype=msg.getData().getString("String_Node_Str");
String referer=msg.getData().getString("String_Node_Str");
Long contentLength=msg.getData().getLong("String_Node_Str");
if (mDownloadListener instanceof BrowserDownloadListener) {
((BrowserDownloadListener)mDownloadListener).onDownloadStart(url,userAgent,contentDisposition,mimetype,referer,contentLength);
}
 else {
mDownloadListener.onDownloadStart(url,userAgent,contentDisposition,mimetype,contentLength);
}
}
break;
case CREATE_WINDOW:
if (mWebChromeClient != null) {
if (!mWebChromeClient.onCreateWindow(mWebView.getWebView(),msg.arg1 == 1,msg.arg2 == 1,(Message)msg.obj)) {
synchronized (this) {
notify();
}
}
mWebView.dismissZoomControl();
}
break;
case REQUEST_FOCUS:
if (mWebChromeClient != null) {
mWebChromeClient.onRequestFocus(mWebView.getWebView());
}
break;
case CLOSE_WINDOW:
if (mWebChromeClient != null) {
mWebChromeClient.onCloseWindow(((WebViewClassic)msg.obj).getWebView());
}
break;
case SAVE_PASSWORD:
Bundle bundle=msg.getData();
String schemePlusHost=bundle.getString("String_Node_Str");
String username=bundle.getString("String_Node_Str");
String password=bundle.getString("String_Node_Str");
if (!mWebView.onSavePassword(schemePlusHost,username,password,(Message)msg.obj)) {
synchronized (this) {
notify();
}
}
break;
case ASYNC_KEYEVENTS:
if (mWebViewClient != null) {
mWebViewClient.onUnhandledKeyEvent(mWebView.getWebView(),(KeyEvent)msg.obj);
}
break;
case EXCEEDED_DATABASE_QUOTA:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
String databaseIdentifier=(String)map.get("String_Node_Str");
String url=(String)map.get("String_Node_Str");
long quota=((Long)map.get("String_Node_Str")).longValue();
long totalQuota=((Long)map.get("String_Node_Str")).longValue();
long estimatedDatabaseSize=((Long)map.get("String_Node_Str")).longValue();
WebStorage.QuotaUpdater quotaUpdater=(WebStorage.QuotaUpdater)map.get("String_Node_Str");
mWebChromeClient.onExceededDatabaseQuota(url,databaseIdentifier,quota,estimatedDatabaseSize,totalQuota,quotaUpdater);
}
break;
case REACHED_APPCACHE_MAXSIZE:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
long requiredStorage=((Long)map.get("String_Node_Str")).longValue();
long quota=((Long)map.get("String_Node_Str")).longValue();
WebStorage.QuotaUpdater quotaUpdater=(WebStorage.QuotaUpdater)map.get("String_Node_Str");
mWebChromeClient.onReachedMaxAppCacheSize(requiredStorage,quota,quotaUpdater);
}
break;
case GEOLOCATION_PERMISSIONS_SHOW_PROMPT:
if (mWebChromeClient != null) {
HashMap<String,Object> map=(HashMap<String,Object>)msg.obj;
String origin=(String)map.get("String_Node_Str");
GeolocationPermissions.Callback callback=(GeolocationPermissions.Callback)map.get("String_Node_Str");
mWebChromeClient.onGeolocationPermissionsShowPrompt(origin,callback);
}
break;
case GEOLOCATION_PERMISSIONS_HIDE_PROMPT:
if (mWebChromeClient != null) {
mWebChromeClient.onGeolocationPermissionsHidePrompt();
}
break;
case JS_DIALOG:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
JsDialogHelper helper=new JsDialogHelper(receiver.mJsResult,msg);
if (!helper.invokeCallback(mWebChromeClient,mWebView.getWebView())) {
helper.showDialog(mContext);
}
receiver.setReady();
}
break;
case JS_TIMEOUT:
if (mWebChromeClient != null) {
final JsResultReceiver receiver=(JsResultReceiver)msg.obj;
final JsResult res=receiver.mJsResult;
if (mWebChromeClient.onJsTimeout()) {
res.confirm();
}
 else {
res.cancel();
}
receiver.setReady();
}
break;
case RECEIVED_CERTIFICATE:
mWebView.setCertificate((SslCertificate)msg.obj);
break;
case NOTIFY:
synchronized (this) {
notify();
}
break;
case SCALE_CHANGED:
if (mWebViewClient != null) {
mWebViewClient.onScaleChanged(mWebView.getWebView(),msg.getData().getFloat("String_Node_Str"),msg.getData().getFloat("String_Node_Str"));
}
break;
case SWITCH_OUT_HISTORY:
mWebView.switchOutDrawHistory();
break;
case ADD_MESSAGE_TO_CONSOLE:
if (mWebChromeClient == null) {
break;
}
String message=msg.getData().getString("String_Node_Str");
String sourceID=msg.getData().getString("String_Node_Str");
int lineNumber=msg.getData().getInt("String_Node_Str");
int msgLevel=msg.getData().getInt("String_Node_Str");
int numberOfMessageLevels=ConsoleMessage.MessageLevel.values().length;
if (msgLevel < 0 || msgLevel >= numberOfMessageLevels) {
msgLevel=0;
}
ConsoleMessage.MessageLevel messageLevel=ConsoleMessage.MessageLevel.values()[msgLevel];
if (!mWebChromeClient.onConsoleMessage(new ConsoleMessage(message,sourceID,lineNumber,messageLevel))) {
String logTag="String_Node_Str";
String logMessage=message + "String_Node_Str" + sourceID+ "String_Node_Str"+ lineNumber;
switch (messageLevel) {
case TIP:
Log.v(logTag,logMessage);
break;
case LOG:
Log.i(logTag,logMessage);
break;
case WARNING:
Log.w(logTag,logMessage);
break;
case ERROR:
Log.e(logTag,logMessage);
break;
case DEBUG:
Log.d(logTag,logMessage);
break;
}
}
break;
case GET_VISITED_HISTORY:
if (mWebChromeClient != null) {
mWebChromeClient.getVisitedHistory((ValueCallback<String[]>)msg.obj);
}
break;
case OPEN_FILE_CHOOSER:
if (mWebChromeClient != null) {
UploadFileMessageData data=(UploadFileMessageData)msg.obj;
mWebChromeClient.openFileChooser(data.getUploadFile(),data.getAcceptType(),data.getCapture());
}
break;
case ADD_HISTORY_ITEM:
if (mWebBackForwardListClient != null) {
mWebBackForwardListClient.onNewHistoryItem((WebHistoryItem)msg.obj);
}
break;
case HISTORY_INDEX_CHANGED:
if (mWebBackForwardListClient != null) {
mWebBackForwardListClient.onIndexChanged((WebHistoryItem)msg.obj,msg.arg1);
}
break;
case AUTH_CREDENTIALS:
{
String host=msg.getData().getString("String_Node_Str");
String realm=msg.getData().getString("String_Node_Str");
username=msg.getData().getString("String_Node_Str");
password=msg.getData().getString("String_Node_Str");
mWebView.setHttpAuthUsernamePassword(host,realm,username,password);
break;
}
case AUTO_LOGIN:
{
if (mWebViewClient != null) {
String realm=msg.getData().getString("String_Node_Str");
String account=msg.getData().getString("String_Node_Str");
String args=msg.getData().getString("String_Node_Str");
mWebViewClient.onReceivedLoginRequest(mWebView.getWebView(),realm,account,args);
}
break;
}
}
}