mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 566799 - e10s: Make IPC::URI the go-to for all IPC URI action. r=dwitte
This commit is contained in:
parent
840b7d952b
commit
c401bd7c7a
@ -45,6 +45,7 @@
|
||||
#include "nsIIPCSerializable.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
@ -80,7 +81,24 @@ struct ParamTraits<URI>
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIIPCSerializable> serializable = do_QueryInterface(aParam.mURI);
|
||||
NS_ABORT_IF_FALSE(serializable, "All IPDL URIs must be serializable");
|
||||
if (!serializable) {
|
||||
nsCString scheme;
|
||||
aParam.mURI->GetScheme(scheme);
|
||||
NS_ABORT_IF_FALSE(scheme.EqualsASCII("about:"),
|
||||
"All IPDL URIs must be serializable or an allowed scheme");
|
||||
}
|
||||
|
||||
bool isSerialized = !!serializable;
|
||||
WriteParam(aMsg, isSerialized);
|
||||
if (!isSerialized) {
|
||||
nsCString spec, charset;
|
||||
aParam.mURI->GetSpec(spec);
|
||||
aParam.mURI->GetOriginCharset(charset);
|
||||
WriteParam(aMsg, spec);
|
||||
WriteParam(aMsg, charset);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aParam.mURI);
|
||||
char cidStr[NSID_LENGTH];
|
||||
nsCID cid;
|
||||
@ -101,6 +119,24 @@ struct ParamTraits<URI>
|
||||
aResult->mURI = nsnull;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSerialized;
|
||||
if (!ReadParam(aMsg, aIter, &isSerialized))
|
||||
return false;
|
||||
if (!isSerialized) {
|
||||
nsCString spec, charset;
|
||||
if (!ReadParam(aMsg, aIter, &spec) ||
|
||||
!ReadParam(aMsg, aIter, &charset))
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), spec, charset.get());
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
uri.forget(&aResult->mURI);
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCAutoString cidStr;
|
||||
nsCID cid;
|
||||
|
Loading…
Reference in New Issue
Block a user