зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1519711 - Make nsIURI::SchemeIs return false when passed null scheme r=qdot
Differential Revision: https://phabricator.services.mozilla.com/D16409 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2e7be963fb
Коммит
1403ae7440
|
@ -418,8 +418,11 @@ nsMozIconURI::EqualsExceptRef(nsIURI* other, bool* result) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMozIconURI::SchemeIs(const char* aScheme, bool* aEquals) {
|
||||
MOZ_ASSERT(aScheme);
|
||||
MOZ_ASSERT(aEquals, "null pointer");
|
||||
if (!aScheme) {
|
||||
*aEquals = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aEquals = PL_strcasecmp("moz-icon", aScheme) ? false : true;
|
||||
return NS_OK;
|
||||
|
|
|
@ -475,8 +475,11 @@ nsJARURI::EqualsExceptRef(nsIURI *other, bool *result) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SchemeIs(const char *i_Scheme, bool *o_Equals) {
|
||||
MOZ_ASSERT(i_Scheme);
|
||||
MOZ_ASSERT(o_Equals);
|
||||
if (!i_Scheme) {
|
||||
*o_Equals = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*o_Equals = PL_strcasecmp("jar", i_Scheme) ? false : true;
|
||||
return NS_OK;
|
||||
|
|
|
@ -523,8 +523,11 @@ bool nsSimpleURI::EqualsInternal(nsSimpleURI *otherUri,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::SchemeIs(const char *i_Scheme, bool *o_Equals) {
|
||||
MOZ_ASSERT(i_Scheme);
|
||||
MOZ_ASSERT(o_Equals, "null pointer");
|
||||
if (!i_Scheme) {
|
||||
*o_Equals = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const char *this_scheme = mScheme.get();
|
||||
|
||||
|
|
|
@ -2204,8 +2204,11 @@ nsresult nsStandardURL::EqualsInternal(
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SchemeIs(const char *scheme, bool *result) {
|
||||
MOZ_ASSERT(scheme);
|
||||
MOZ_ASSERT(result, "null pointer");
|
||||
if (!scheme) {
|
||||
*result = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*result = SegmentIs(mScheme, scheme);
|
||||
return NS_OK;
|
||||
|
|
|
@ -610,12 +610,27 @@ function check_space_escaping()
|
|||
uri = gIoService.newURI("http://example.com/test%20path#test%20path");
|
||||
}
|
||||
|
||||
function check_schemeIsNull()
|
||||
{
|
||||
let uri = gIoService.newURI("data:text/plain,aaa");
|
||||
Assert.ok(!uri.schemeIs(null));
|
||||
uri = gIoService.newURI("http://example.com");
|
||||
Assert.ok(!uri.schemeIs(null));
|
||||
uri = gIoService.newURI("dummyscheme://example.com");
|
||||
Assert.ok(!uri.schemeIs(null));
|
||||
uri = gIoService.newURI("jar:resource://gre/chrome.toolkit.jar!/");
|
||||
Assert.ok(!uri.schemeIs(null));
|
||||
uri = gIoService.newURI("moz-icon://.unknown?size=32");
|
||||
Assert.ok(!uri.schemeIs(null));
|
||||
}
|
||||
|
||||
// TEST MAIN FUNCTION
|
||||
// ------------------
|
||||
function run_test()
|
||||
{
|
||||
check_nested_mutations();
|
||||
check_space_escaping();
|
||||
check_schemeIsNull();
|
||||
|
||||
// UTF-8 check - From bug 622981
|
||||
// ASCII
|
||||
|
|
Загрузка…
Ссылка в новой задаче