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/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);