From 7b6955578d914557eea7ff3cbcec70e953970092 Mon Sep 17 00:00:00 2001
From: John Reck <jreck@google.com>
Date: Tue, 21 Jun 2011 14:15:19 -0700
Subject: [PATCH] DO NOT MERGE Prevent loading javascript: uris in existing
 tabs

 Bug: 4770356

Change-Id: I436d97f0c41fedec16891c92bf283654354b0a29
---
 src/com/android/browser/BrowserActivity.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 50521a96..d94e1bfd 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;
         }
 
-- 
GitLab