Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 366913006: [Android WebView] Terminate execution of stuck JS code on navigation requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.ComponentCallbacks2; 9 import android.content.ComponentCallbacks2;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 1021
1022 /** 1022 /**
1023 * Load url without fixing up the url string. Consumers of ContentView are r esponsible for 1023 * Load url without fixing up the url string. Consumers of ContentView are r esponsible for
1024 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee n added if left 1024 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee n added if left
1025 * off during user input). 1025 * off during user input).
1026 * 1026 *
1027 * @param params Parameters for this load. 1027 * @param params Parameters for this load.
1028 */ 1028 */
1029 public void loadUrl(LoadUrlParams params) { 1029 public void loadUrl(LoadUrlParams params) {
1030 if (mNativeAwContents == 0) return;
1031
1030 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA && 1032 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA &&
1031 !params.isBaseUrlDataScheme()) { 1033 !params.isBaseUrlDataScheme()) {
1032 // This allows data URLs with a non-data base URL access to file:/// android_asset/ and 1034 // This allows data URLs with a non-data base URL access to file:/// android_asset/ and
1033 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi ts, it will also 1035 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi ts, it will also
1034 // allow access to file:// URLs (subject to OS level permission chec ks). 1036 // allow access to file:// URLs (subject to OS level permission chec ks).
1035 params.setCanLoadLocalResources(true); 1037 params.setCanLoadLocalResources(true);
1036 } 1038 }
1037 1039
1038 // If we are reloading the same url, then set transition type as reload. 1040 // If we are reloading the same url, then set transition type as reload.
1039 if (params.getUrl() != null && 1041 if (params.getUrl() != null &&
(...skipping 18 matching lines...) Expand all
1058 if (extraHeaders != null) { 1060 if (extraHeaders != null) {
1059 for (String header : extraHeaders.keySet()) { 1061 for (String header : extraHeaders.keySet()) {
1060 if (REFERER.equals(header.toLowerCase(Locale.US))) { 1062 if (REFERER.equals(header.toLowerCase(Locale.US))) {
1061 params.setReferrer(new Referrer(extraHeaders.remove(header), 1)); 1063 params.setReferrer(new Referrer(extraHeaders.remove(header), 1));
1062 params.setExtraHeaders(extraHeaders); 1064 params.setExtraHeaders(extraHeaders);
1063 break; 1065 break;
1064 } 1066 }
1065 } 1067 }
1066 } 1068 }
1067 1069
1068 if (mNativeAwContents != 0) { 1070 nativeSetExtraHeadersForUrl(
1069 nativeSetExtraHeadersForUrl( 1071 mNativeAwContents, params.getUrl(), params.getExtraHttpRequestHe adersString());
1070 mNativeAwContents, params.getUrl(), params.getExtraHttpReque stHeadersString());
1071 }
1072 params.setExtraHeaders(new HashMap<String, String>()); 1072 params.setExtraHeaders(new HashMap<String, String>());
1073 1073
1074 nativeSendCheckRenderThreadResponsiveness(mNativeAwContents);
1074 mContentViewCore.loadUrl(params); 1075 mContentViewCore.loadUrl(params);
1075 1076
1076 // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit. 1077 // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit.
1077 // Chromium does not use this use code path and the best emulation of th is behavior to call 1078 // Chromium does not use this use code path and the best emulation of th is behavior to call
1078 // request visited links once on the first URL load of the WebView. 1079 // request visited links once on the first URL load of the WebView.
1079 if (!mHasRequestedVisitedHistoryFromClient) { 1080 if (!mHasRequestedVisitedHistoryFromClient) {
1080 mHasRequestedVisitedHistoryFromClient = true; 1081 mHasRequestedVisitedHistoryFromClient = true;
1081 requestVisitedHistoryFromClient(); 1082 requestVisitedHistoryFromClient();
1082 } 1083 }
1083 1084
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 private native long nativeReleasePopupAwContents(long nativeAwContents); 2452 private native long nativeReleasePopupAwContents(long nativeAwContents);
2452 private native void nativeFocusFirstNode(long nativeAwContents); 2453 private native void nativeFocusFirstNode(long nativeAwContents);
2453 private native void nativeSetBackgroundColor(long nativeAwContents, int colo r); 2454 private native void nativeSetBackgroundColor(long nativeAwContents, int colo r);
2454 2455
2455 private native long nativeGetAwDrawGLViewContext(long nativeAwContents); 2456 private native long nativeGetAwDrawGLViewContext(long nativeAwContents);
2456 private native long nativeCapturePicture(long nativeAwContents, int width, i nt height); 2457 private native long nativeCapturePicture(long nativeAwContents, int width, i nt height);
2457 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean enabled); 2458 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean enabled);
2458 private native void nativeClearView(long nativeAwContents); 2459 private native void nativeClearView(long nativeAwContents);
2459 private native void nativeSetExtraHeadersForUrl(long nativeAwContents, 2460 private native void nativeSetExtraHeadersForUrl(long nativeAwContents,
2460 String url, String extraHeaders); 2461 String url, String extraHeaders);
2462 private native void nativeSendCheckRenderThreadResponsiveness(long nativeAwC ontents);
2461 2463
2462 private native void nativeInvokeGeolocationCallback( 2464 private native void nativeInvokeGeolocationCallback(
2463 long nativeAwContents, boolean value, String requestingFrame); 2465 long nativeAwContents, boolean value, String requestingFrame);
2464 2466
2465 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean networkUp); 2467 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean networkUp);
2466 2468
2467 private native void nativeTrimMemory(long nativeAwContents, int level, boole an visible); 2469 private native void nativeTrimMemory(long nativeAwContents, int level, boole an visible);
2468 2470
2469 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter); 2471 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter);
2470 2472
2471 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 2473 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
2472 long resources); 2474 long resources);
2473 } 2475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698