Extension fixes (#6284)

* Fix token symbols in extension.

* Allow connections from firefox extension.
This commit is contained in:
Tomasz Drwięga 2017-08-13 17:41:50 +02:00 committed by Gav Wood
parent b5b6e3dd2a
commit 10068cee72
4 changed files with 11 additions and 6 deletions

View File

@ -64,14 +64,19 @@ class FakeTransport {
class FrameSecureApi extends SecureApi { class FrameSecureApi extends SecureApi {
constructor (transport) { constructor (transport) {
super(transport.uiUrl, null, () => { super(
return transport; transport.uiUrl,
}); null,
() => transport,
() => 'http:'
);
} }
connect () { connect () {
// Do nothing - this API does not need connecting // Do nothing - this API does not need connecting
this.emit('connecting'); this.emit('connecting');
// Fetch settings
this._fetchSettings();
// Fire connected event with some delay. // Fire connected event with some delay.
setTimeout(() => { setTimeout(() => {
this.emit('connected'); this.emit('connected');

View File

@ -195,7 +195,7 @@ usage! {
or |c: &Config| otry!(c.websockets).interface.clone(), or |c: &Config| otry!(c.websockets).interface.clone(),
flag_ws_apis: String = "web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore,shh,shh_pubsub", flag_ws_apis: String = "web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore,shh,shh_pubsub",
or |c: &Config| otry!(c.websockets).apis.as_ref().map(|vec| vec.join(",")), or |c: &Config| otry!(c.websockets).apis.as_ref().map(|vec| vec.join(",")),
flag_ws_origins: String = "chrome-extension://*", flag_ws_origins: String = "chrome-extension://*,moz-extension://*",
or |c: &Config| otry!(c.websockets).origins.as_ref().map(|vec| vec.join(",")), or |c: &Config| otry!(c.websockets).origins.as_ref().map(|vec| vec.join(",")),
flag_ws_hosts: String = "none", flag_ws_hosts: String = "none",
or |c: &Config| otry!(c.websockets).hosts.as_ref().map(|vec| vec.join(",")), or |c: &Config| otry!(c.websockets).hosts.as_ref().map(|vec| vec.join(",")),

View File

@ -1301,7 +1301,7 @@ mod tests {
interface: "127.0.0.1".into(), interface: "127.0.0.1".into(),
port: 8546, port: 8546,
apis: ApiSet::UnsafeContext, apis: ApiSet::UnsafeContext,
origins: Some(vec!["chrome-extension://*".into()]), origins: Some(vec!["chrome-extension://*".into(), "moz-extension://*".into()]),
hosts: Some(vec![]), hosts: Some(vec![]),
signer_path: expected.into(), signer_path: expected.into(),
ui_address: Some(("127.0.0.1".to_owned(), 8180)), ui_address: Some(("127.0.0.1".to_owned(), 8180)),

View File

@ -163,7 +163,7 @@ impl Default for WsConfiguration {
interface: "127.0.0.1".into(), interface: "127.0.0.1".into(),
port: 8546, port: 8546,
apis: ApiSet::UnsafeContext, apis: ApiSet::UnsafeContext,
origins: Some(vec!["chrome-extension://*".into()]), origins: Some(vec!["chrome-extension://*".into(), "moz-extension://*".into()]),
hosts: Some(Vec::new()), hosts: Some(Vec::new()),
signer_path: replace_home(&data_dir, "$BASE/signer").into(), signer_path: replace_home(&data_dir, "$BASE/signer").into(),
support_token_api: true, support_token_api: true,