mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1851847 - Check that we really do have a document before creating a MIDI port r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D187989
This commit is contained in:
parent
0a1616968d
commit
fccf853420
@ -63,7 +63,16 @@ MIDIPort::~MIDIPort() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MIDIPort::Initialize(const MIDIPortInfo& aPortInfo, bool aSysexEnabled) {
|
bool MIDIPort::Initialize(const MIDIPortInfo& aPortInfo, bool aSysexEnabled) {
|
||||||
nsIURI* uri = GetDocumentIfCurrent()->GetDocumentURI();
|
nsCOMPtr<Document> document = GetDocumentIfCurrent();
|
||||||
|
if (!document) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> uri = document->GetDocumentURI();
|
||||||
|
if (!uri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
nsAutoCString origin;
|
nsAutoCString origin;
|
||||||
nsresult rv = nsContentUtils::GetWebExposedOriginSerialization(uri, origin);
|
nsresult rv = nsContentUtils::GetWebExposedOriginSerialization(uri, origin);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user