OSDN Git Service

DO NOT MERGE Prevent loading javascript: uris in existing tabs
authorJohn Reck <jreck@google.com>
Tue, 21 Jun 2011 21:15:19 +0000 (14:15 -0700)
committerandroid-merger <android-build@android.com>
Fri, 24 Jun 2011 18:19:02 +0000 (11:19 -0700)
 Bug: 4770356

Change-Id: I436d97f0c41fedec16891c92bf283654354b0a29

src/com/android/browser/BrowserActivity.java

index 50521a9..d94e1bf 100644 (file)
@@ -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;
         }