Program: 26078
Project: 26078
Buggy source:
@SuppressLint("String_Node_Str") private void init_webView(){
  int backgroundColor=ColorHelper.getColorFromAttribute(getContext(),R.attr.news_detail_background_color);
  mWebView.setBackgroundColor(backgroundColor);
  WebSettings webSettings=mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setAllowFileAccess(true);
  webSettings.setDomStorageEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(false);
  webSettings.setSupportMultipleWindows(false);
  webSettings.setSupportZoom(false);
  webSettings.setAppCacheEnabled(true);
  registerForContextMenu(mWebView);
  mWebView.setWebChromeClient(new ProgressBarWebChromeClient(mProgressbarWebView));
  mWebView.setWebViewClient(new WebViewClient(){
    private Map<String,Boolean> loadedUrls=new HashMap<>();
    @Override public WebResourceResponse shouldInterceptRequest(    WebView view,    String url){
      boolean isAd;
      if (!loadedUrls.containsKey(url)) {
        isAd=AdBlocker.isAd(url);
        loadedUrls.put(url,isAd);
      }
 else {
        isAd=loadedUrls.get(url);
      }
      return isAd ? AdBlocker.createEmptyResource() : super.shouldInterceptRequest(view,url);
    }
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
      int selectedBrowser=Integer.parseInt(mPrefs.getString(SettingsActivity.SP_DISPLAY_BROWSER,"String_Node_Str"));
      boolean result=true;
switch (selectedBrowser) {
case 0:
        CustomTabsIntent.Builder builder=new CustomTabsIntent.Builder();
      builder.setToolbarColor(ContextCompat.getColor(getActivity(),R.color.colorPrimaryDarkTheme));
    builder.setShowTitle(true);
  builder.setStartAnimations(getActivity(),R.anim.slide_in_right,R.anim.slide_out_left);
builder.setExitAnimations(getActivity(),R.anim.slide_in_left,R.anim.slide_out_right);
builder.build().launchUrl(getActivity(),Uri.parse(url));
result=true;
break;
case 1:
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
startActivity(browserIntent);
break;
case 2:
result=super.shouldOverrideUrlLoading(view,url);
break;
}
return result;
}
@Override public void onPageFinished(WebView view,String url){
super.onPageFinished(view,url);
NewsDetailActivity ndActivity=((NewsDetailActivity)getActivity());
int backgroundColor=ColorHelper.getColorFromAttribute(getContext(),R.attr.news_detail_background_color);
mWebView.setBackgroundColor(backgroundColor);
ndActivity.mViewPager.setBackgroundColor(backgroundColor);
}
}
);
mWebView.setOnTouchListener(new View.OnTouchListener(){
@Override public boolean onTouch(View v,MotionEvent event){
if (v.getId() == R.id.webview && event.getAction() == MotionEvent.ACTION_DOWN) {
changedUrl=true;
}
return false;
}
}
);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private void init_webView(){
  int backgroundColor=ColorHelper.getColorFromAttribute(getContext(),R.attr.news_detail_background_color);
  mWebView.setBackgroundColor(backgroundColor);
  WebSettings webSettings=mWebView.getSettings();
  webSettings.setJavaScriptEnabled(true);
  webSettings.setAllowContentAccess(true);
  webSettings.setAllowFileAccess(true);
  webSettings.setDomStorageEnabled(true);
  webSettings.setJavaScriptCanOpenWindowsAutomatically(false);
  webSettings.setSupportMultipleWindows(false);
  webSettings.setSupportZoom(false);
  webSettings.setAppCacheEnabled(true);
  webSettings.setMediaPlaybackRequiresUserGesture(true);
  registerForContextMenu(mWebView);
  mWebView.setWebChromeClient(new ProgressBarWebChromeClient(mProgressbarWebView));
  mWebView.setWebViewClient(new WebViewClient(){
    private Map<String,Boolean> loadedUrls=new HashMap<>();
    @Override public WebResourceResponse shouldInterceptRequest(    WebView view,    String url){
      boolean isAd;
      if (!loadedUrls.containsKey(url)) {
        isAd=AdBlocker.isAd(url);
        loadedUrls.put(url,isAd);
      }
 else {
        isAd=loadedUrls.get(url);
      }
      return isAd ? AdBlocker.createEmptyResource() : super.shouldInterceptRequest(view,url);
    }
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      SharedPreferences mPrefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
      int selectedBrowser=Integer.parseInt(mPrefs.getString(SettingsActivity.SP_DISPLAY_BROWSER,"String_Node_Str"));
      boolean result=true;
switch (selectedBrowser) {
case 0:
        CustomTabsIntent.Builder builder=new CustomTabsIntent.Builder();
      builder.setToolbarColor(ContextCompat.getColor(getActivity(),R.color.colorPrimaryDarkTheme));
    builder.setShowTitle(true);
  builder.setStartAnimations(getActivity(),R.anim.slide_in_right,R.anim.slide_out_left);
builder.setExitAnimations(getActivity(),R.anim.slide_in_left,R.anim.slide_out_right);
builder.build().launchUrl(getActivity(),Uri.parse(url));
result=true;
break;
case 1:
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
startActivity(browserIntent);
break;
case 2:
result=super.shouldOverrideUrlLoading(view,url);
break;
}
return result;
}
@Override public void onPageFinished(WebView view,String url){
super.onPageFinished(view,url);
NewsDetailActivity ndActivity=((NewsDetailActivity)getActivity());
int backgroundColor=ColorHelper.getColorFromAttribute(getContext(),R.attr.news_detail_background_color);
mWebView.setBackgroundColor(backgroundColor);
ndActivity.mViewPager.setBackgroundColor(backgroundColor);
}
}
);
mWebView.setOnTouchListener(new View.OnTouchListener(){
@Override public boolean onTouch(View v,MotionEvent event){
if (v.getId() == R.id.webview && event.getAction() == MotionEvent.ACTION_DOWN) {
changedUrl=true;
}
return false;
}
}
);
}