Developer Plugin should allow whitelisting of code server hosts
Solution was to whitelist the host/code servers as a pair.  In order to do
this, both common and browser specific code had to be modified.
Common:
  AllowedConnections:
    +Adding static getCodeServerFromUrl() to aid in fetching "gwt.codesvr="
values.
    +Modifying definition of internal Rule class from an stl-pairing of string &
bool
     to a simple class holding the host & code servers as strings and bool
expection
    +Updating matchesRule() to take host and code server as params
    +Update addRule() and initFromAccessList() to handle new pairing:
     [!]host[/code][,[!][host[/code]...]
Browsers:
  FireFox / Chrome:
    +Update UI to show both host/code server



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10242 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib b/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
index a9cedcc..b089cef 100755
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/Darwin-gcc3/gwtDev.plugin/Contents/MacOS/libGwtDevPlugin.dylib
Binary files differ
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86-gcc3/libGwtDevPlugin.so b/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86-gcc3/libGwtDevPlugin.so
index 4783c49..a25d124 100755
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86-gcc3/libGwtDevPlugin.so
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86-gcc3/libGwtDevPlugin.so
Binary files differ
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86_64-gcc3/libGwtDevPlugin.so b/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86_64-gcc3/libGwtDevPlugin.so
index cf3b9f2..c0e4546 100755
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86_64-gcc3/libGwtDevPlugin.so
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/Linux_x86_64-gcc3/libGwtDevPlugin.so
Binary files differ
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/WINNT_x86-msvc/npGwtDevPlugin.dll b/plugins/npapi/prebuilt/gwt-dev-plugin/WINNT_x86-msvc/npGwtDevPlugin.dll
index 1e62460..cbc3f58 100755
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/WINNT_x86-msvc/npGwtDevPlugin.dll
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/WINNT_x86-msvc/npGwtDevPlugin.dll
Binary files differ
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/background.html b/plugins/npapi/prebuilt/gwt-dev-plugin/background.html
index 2569678..fe60956 100644
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/background.html
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/background.html
@@ -22,23 +22,48 @@
   }
   idx = hostname.indexOf('/');
   if (idx >= 0) {
-    hostname = hostname.split('/')[0];
+    hostname = hostname.substring(0,idx);
+  }
+  idx = hostname.indexOf('@');
+  if( idx >= 0)
+  {
+    hostname = hostname.substring(idx+1);
   }
   idx = hostname.indexOf(':');
   if (idx >= 0) {
-    hostname = hostname.split(':')[0];
+    hostname = hostname.substring(0,idx);
   }
   return hostname;
 }
 
+function getCodeServerFromUrl(url) {
+  var idx = url.indexOf('?');
+  if (idx < 0) {
+    return '';
+  }
+  url = url.substring(idx+1);
+  idx = url.indexOf('gwt.codesvr=');
+  if( idx < 0 ) {
+    return '';
+  }
+  url = url.substring(idx+12);
+  var colon = url.indexOf(':');
+  var amp   = url.indexOf('&');
+  if( amp < 0 || colon < amp ) {
+    amp = colon;
+  }
+  return amp < 0 ? url : url.substring(0,amp);
+}
+
 function devModeTabListener(tabId, changeInfo, tab) {
   var search = tab.url.slice(tab.url.indexOf('?'));
   if (search.indexOf('gwt.codesvr=') >= 0 || search.indexOf('gwt.hosted=') >= 0) {
     var permission = plugin.getHostPermission(tab.url);
     var host = getHostFromUrl(tab.url);
+    var code = getCodeServerFromUrl(tab.url);
     var popup = 'page_action.html';
     var icon = null;
-    console.log("got permission " + permission + " for host " + host);
+    console.log("got permission " + permission + " for host " + host + '/ code ' + code);
 
     if (permission == 'include') {
       icon = enabledIcon;
@@ -47,7 +72,7 @@
     } else if (permission == 'unknown') {
       icon = disabledIcon;
     }
-    popup += "?permission=" + permission + "&host=" + host;
+    popup += "?permission=" + permission + "&host=" + host + "&codeserver=" + code;
     chrome.pageAction.setIcon({'tabId' : tabId, 'path' : icon});
     chrome.pageAction.setPopup({'tabId' : tabId, 'popup' : popup});
     chrome.pageAction.show(tabId);
diff --git a/plugins/npapi/prebuilt/gwt-dev-plugin/page_action.html b/plugins/npapi/prebuilt/gwt-dev-plugin/page_action.html
index f891515..4094828 100644
--- a/plugins/npapi/prebuilt/gwt-dev-plugin/page_action.html
+++ b/plugins/npapi/prebuilt/gwt-dev-plugin/page_action.html
@@ -18,21 +18,22 @@
     function init() {
       var permission = getParam('permission');
       var host = getParam('host');
+      var code = getParam('codeserver');
       var message='';
 
       if (permission == 'include') {
-        message = 'The host at ' + host + ' is allowed to use the plugin';
+        message = 'The web and code server (' + host + '/' + code + ') is allowed to use the plugin';
       } else if (permission == 'exclude') {
-        message = 'The host at ' + host + ' has been been blacklisted.';
+        message = 'The web and code server (' + host + '/' + code + ') has been been blacklisted.';
       } else if (permission == 'unknown') {
-        message = 'The host at ' + host + ' is unknown to the plugin.';
+        message = 'The web and code server (' + host + '/' + code + ') is unknown to the plugin.';
       }
 
       document.getElementById('message').innerText = message;
     }
 
     function updateConfiguration() {
-      var url = 'DevModeOptions.html?host=' + getParam('host');
+      var url = 'DevModeOptions.html?host=' + getParam('host') + '&codeserver=' + getParam('codeserver');
       url = chrome.extension.getURL(url);
       chrome.tabs.create({'url' : url});
     }