mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1358946 - Strip about:reader in intent data uri. r=maliu
MozReview-Commit-ID: AQ8txBAbtUr --HG-- extra : amend_source : 5128c93b4796f3d9c568bf55aaa743c4493a0a84
This commit is contained in:
parent
4924c09590
commit
f4108311cc
@ -4504,9 +4504,6 @@ Tab.prototype = {
|
||||
ExternalApps.updatePageActionUri(fixedURI);
|
||||
}
|
||||
|
||||
// Strip reader mode URI and also make it exposable if needed
|
||||
fixedURI = this._stripAboutReaderURL(fixedURI);
|
||||
|
||||
let message = {
|
||||
type: "Content:LocationChange",
|
||||
tabID: this.id,
|
||||
@ -4533,10 +4530,6 @@ Tab.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_stripAboutReaderURL: function (originalURI) {
|
||||
return ReaderMode.getOriginalUrlObjectForDisplay(originalURI.spec) || originalURI;
|
||||
},
|
||||
|
||||
// Properties used to cache security state used to update the UI
|
||||
_state: null,
|
||||
_hostChanged: false, // onLocationChange will flip this bit
|
||||
|
@ -25,6 +25,7 @@ public class SafeIntent {
|
||||
private final Intent intent;
|
||||
|
||||
public SafeIntent(final Intent intent) {
|
||||
stripDataUri(intent);
|
||||
this.intent = intent;
|
||||
}
|
||||
|
||||
@ -131,4 +132,19 @@ public class SafeIntent {
|
||||
public Intent getUnsafe() {
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static void stripDataUri(final Intent intent) {
|
||||
// We should limit intent filters and check incoming intents against white-list
|
||||
// But for now we just strip 'about:reader?url='
|
||||
if (intent != null && intent.getData() != null) {
|
||||
final String url = intent.getData().toString();
|
||||
final String prefix = "about:reader?url=";
|
||||
if (url != null && url.startsWith(prefix)) {
|
||||
final String strippedUrl = url.replace(prefix, "");
|
||||
if (strippedUrl != null) {
|
||||
intent.setData(Uri.parse(strippedUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user