diff options
Diffstat (limited to 'dom')
-rw-r--r-- | dom/indexedDB/ActorsChild.cpp | 6 | ||||
-rw-r--r-- | dom/security/nsCSPUtils.cpp | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index 30dc9b6dab..85f876cdc1 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -3291,6 +3291,10 @@ BackgroundCursorChild::HandleResponse( auto& responses = const_cast<nsTArray<ObjectStoreCursorResponse>&>(aResponses); + // If a new cursor is created, we need to keep a reference to it until the + // ResultHelper creates a DOM Binding. + RefPtr<IDBCursor> newCursor; + for (ObjectStoreCursorResponse& response : responses) { StructuredCloneReadInfo cloneReadInfo(Move(response.cloneInfo())); cloneReadInfo.mDatabase = mTransaction->Database(); @@ -3300,8 +3304,6 @@ BackgroundCursorChild::HandleResponse( nullptr, cloneReadInfo.mFiles); - RefPtr<IDBCursor> newCursor; - if (mCursor) { mCursor->Reset(Move(response.key()), Move(cloneReadInfo)); } else { diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index d07ad79457..6d4f297d6d 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -555,7 +555,21 @@ permitsPort(const nsAString& aEnforcementScheme, int32_t resourcePort; nsresult rv = aResourceURI->GetPort(&resourcePort); - NS_ENSURE_SUCCESS(rv, false); + if (NS_FAILED(rv) && aEnforcementPort.IsEmpty()) { + // If we cannot get a Port (e.g. because of an Custom Protocol handler) + // we need to check if a default port is associated with the Scheme + if (aEnforcementScheme.IsEmpty()) { + return false; + } + int defaultPortforScheme = + NS_GetDefaultPort(NS_ConvertUTF16toUTF8(aEnforcementScheme).get()); + + // If there is no default port associated with the Scheme ( + // defaultPortforScheme == -1) or it is an externally handled protocol ( + // defaultPortforScheme == 0 ) and the csp does not enforce a port - we can + // allow not having a port + return (defaultPortforScheme == -1 || defaultPortforScheme == 0); + } // Avoid unnecessary string creation/manipulation and don't block the // load if the resource to be loaded uses the default port for that |