From: John Reck Date: Tue, 21 Jun 2011 21:15:19 +0000 (-0700) Subject: DO NOT MERGE Prevent loading javascript: uris in existing tabs X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;ds=sidebyside;h=7b6955578d914557eea7ff3cbcec70e953970092;p=android-x86%2Fpackages-apps-Browser.git DO NOT MERGE Prevent loading javascript: uris in existing tabs Bug: 4770356 Change-Id: I436d97f0c41fedec16891c92bf283654354b0a29 --- diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 50521a9..d94e1bf 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -467,6 +467,12 @@ public class BrowserActivity extends Activity final String appId = intent .getStringExtra(Browser.EXTRA_APPLICATION_ID); + if (!TextUtils.isEmpty(urlData.mUrl) && + urlData.mUrl.startsWith("javascript:")) { + // Always open javascript: URIs in new tabs + openTabAndShow(urlData, true, appId); + return; + } if ((Intent.ACTION_VIEW.equals(action) // If a voice search has no appId, it means that it came // from the browser. In that case, reuse the current tab. @@ -2656,8 +2662,9 @@ public class BrowserActivity extends Activity } // The "about:" schemes are internal to the browser; don't want these to - // be dispatched to other apps. - if (url.startsWith("about:")) { + // be dispatched to other apps. Similarly, javascript: schemas are private + // to the page + if (url.startsWith("about:") || url.startsWith("javascript:")) { return false; }