Skip to content

Commit 9b39492

Browse files
committed
FxaServer::China now points at FxaServer::Release
1 parent 799ae23 commit 9b39492

File tree

5 files changed

+4
-34
lines changed

5 files changed

+4
-34
lines changed

components/fxa-client/android/src/main/java/mozilla/appservices/fxaclient/Config.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ package mozilla.appservices.fxaclient
77
fun FxaServer.isCustom() = this is FxaServer.Custom
88

99
fun FxaServer.contentUrl() = when (this) {
10-
is FxaServer.Release -> "https://accounts.firefox.com"
10+
is FxaServer.Release, FxaServer.China -> "https://accounts.firefox.com"
1111
is FxaServer.Stable -> "https://stable.dev.lcip.org"
1212
is FxaServer.Stage -> "https://accounts.stage.mozaws.net"
13-
is FxaServer.China -> "https://accounts.firefox.com.cn"
1413
is FxaServer.LocalDev -> "http://127.0.0.1:3030"
1514
is FxaServer.Custom -> this.url
1615
}

components/fxa-client/src/fxa_client.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ interface FxaServer {
752752
Release();
753753
Stable();
754754
Stage();
755-
China();
755+
China(); // deprecaed, same as Release
756756
LocalDev();
757757
Custom(string url);
758758
};

components/fxa-client/src/internal/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub struct RemoteConfig {
4040
}
4141

4242
pub(crate) const CONTENT_URL_RELEASE: &str = "https://accounts.firefox.com";
43-
pub(crate) const CONTENT_URL_CHINA: &str = "https://accounts.firefox.com.cn";
4443

4544
impl Config {
4645
fn remote_config(&self) -> Result<Arc<RemoteConfig>> {
@@ -211,10 +210,6 @@ impl Config {
211210
Self::new("https://stable.dev.lcip.org", client_id, redirect_uri)
212211
}
213212

214-
pub fn china(client_id: &str, redirect_uri: &str) -> Self {
215-
Self::new(CONTENT_URL_CHINA, client_id, redirect_uri)
216-
}
217-
218213
pub fn new(content_url: &str, client_id: &str, redirect_uri: &str) -> Self {
219214
Self {
220215
content_url: content_url.to_string(),

components/fxa-client/src/internal/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ impl FirefoxAccount {
138138
if self.state.config().content_url()? == content_url_release {
139139
return Ok("https://firefox.com/pair".to_owned());
140140
}
141-
// Similarly special case for the China server.
142-
let content_url_china = Url::parse(config::CONTENT_URL_CHINA)
143-
.expect("hardcoded CONTENT_URL_CHINA failed to parse");
144-
if self.state.config().content_url()? == content_url_china {
145-
return Ok("https://firefox.com.cn/pair".to_owned());
146-
}
147141
Ok(self.state.config().pair_url()?.into())
148142
}
149143

@@ -616,12 +610,5 @@ mod tests {
616610
fxa.get_pairing_authority_url().unwrap().as_str(),
617611
"https://firefox.com/pair"
618612
);
619-
620-
let config = Config::china("12345678", "https://foo.bar");
621-
let fxa = FirefoxAccount::with_config(config);
622-
assert_eq!(
623-
fxa.get_pairing_authority_url().unwrap().as_str(),
624-
"https://firefox.com.cn/pair"
625-
)
626613
}
627614
}

components/fxa-client/src/lib.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ pub enum FxaServer {
137137
impl FxaServer {
138138
fn content_url(&self) -> &str {
139139
match self {
140-
Self::Release => "https://accounts.firefox.com",
140+
Self::Release | Self::China => "https://accounts.firefox.com",
141141
Self::Stable => "https://stable.dev.lcip.org",
142142
Self::Stage => "https://accounts.stage.mozaws.net",
143-
Self::China => "https://accounts.firefox.com.cn",
144143
Self::LocalDev => "http://127.0.0.1:3030",
145144
Self::Custom { url } => url,
146145
}
@@ -159,7 +158,7 @@ impl From<&Url> for FxaServer {
159158
} else if origin == Url::parse(Self::Stage.content_url()).unwrap().origin() {
160159
Self::Stage
161160
} else if origin == Url::parse(Self::China.content_url()).unwrap().origin() {
162-
Self::China
161+
unreachable!("china is release.")
163162
} else if origin == Url::parse(Self::LocalDev.content_url()).unwrap().origin() {
164163
Self::LocalDev
165164
} else {
@@ -216,15 +215,6 @@ impl FxaConfig {
216215
}
217216
}
218217

219-
pub fn china(client_id: impl ToString, redirect_uri: impl ToString) -> Self {
220-
Self {
221-
server: FxaServer::China,
222-
client_id: client_id.to_string(),
223-
redirect_uri: redirect_uri.to_string(),
224-
token_server_url_override: None,
225-
}
226-
}
227-
228218
pub fn dev(client_id: impl ToString, redirect_uri: impl ToString) -> Self {
229219
Self {
230220
server: FxaServer::LocalDev,
@@ -247,7 +237,6 @@ mod tests {
247237
("https://accounts.firefox.com", FxaServer::Release),
248238
("https://stable.dev.lcip.org", FxaServer::Stable),
249239
("https://accounts.stage.mozaws.net", FxaServer::Stage),
250-
("https://accounts.firefox.com.cn", FxaServer::China),
251240
("http://127.0.0.1:3030", FxaServer::LocalDev),
252241
(
253242
"http://my-fxa-server.com",

0 commit comments

Comments
 (0)