mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1295103 - Use MOZ_MUST_USE in OriginAttributes. r=allstars
MozReview-Commit-ID: PWUb81L8ya --HG-- extra : rebase_source : 2bdc7adc7a6b5fd121a4621086fab6f87834dd20
This commit is contained in:
parent
f221acffb2
commit
29b9a17a92
@ -11,6 +11,7 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/ChromeUtilsBinding.h"
|
||||
|
||||
class nsIContentSecurityPolicy;
|
||||
@ -45,11 +46,11 @@ public:
|
||||
// |!key1=value1&key2=value2|. If there are no non-default attributes, this
|
||||
// returns an empty string.
|
||||
void CreateSuffix(nsACString& aStr) const;
|
||||
bool PopulateFromSuffix(const nsACString& aStr);
|
||||
MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
|
||||
|
||||
// Populates the attributes from a string like
|
||||
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
|
||||
bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
|
||||
// Helper function to match mIsPrivateBrowsing to existing private browsing
|
||||
|
@ -139,7 +139,9 @@ ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
|
||||
return false;
|
||||
}
|
||||
|
||||
aAttrs.PopulateFromSuffix(suffix);
|
||||
if (!aAttrs.PopulateFromSuffix(suffix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aSpec.SetLength(specLength);
|
||||
if (!JS_ReadBytes(aReader, aSpec.BeginWriting(), specLength)) {
|
||||
|
@ -13,7 +13,8 @@ TestSuffix(const PrincipalOriginAttributes& attrs)
|
||||
attrs.CreateSuffix(suffix);
|
||||
|
||||
PrincipalOriginAttributes attrsFromSuffix;
|
||||
attrsFromSuffix.PopulateFromSuffix(suffix);
|
||||
bool success = attrsFromSuffix.PopulateFromSuffix(suffix);
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
EXPECT_EQ(attrs, attrsFromSuffix);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user