Skip to content

Commit

Permalink
Use correct origin for chrome.desktopCapture.chooseDekstopMedia
Browse files Browse the repository at this point in the history
NWJS app allows running on origins other than `chrome-extension://*/*`.
The origin should then be from the senders URL, in order not to fail
the origin checking in `DesktopStreamsRegistry::RequestMediaForStreamId`.

Fixed nwjs/nw.js#4579
  • Loading branch information
Cong Liu committed Mar 18, 2016
1 parent e132e74 commit 90c2b02
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ bool DesktopCaptureChooseDesktopMediaFunction::RunAsync() {
}
DCHECK(web_contents);
} else {
origin = extension()->url();
target_name = base::UTF8ToUTF16(extension()->name());
web_contents = GetSenderWebContents();
// NWJS fix for nwjs/nw.js#4579
// NWJS app allows running on origins other than `chrome-extension://*/*`.
// The origin should then be from the senders URL, in order not to fail
// the origin checking in `DesktopStreamsRegistry::RequestMediaForStreamId`.
origin = extension()->is_nwjs_app() ? web_contents->GetURL().GetOrigin() : extension()->url();
DCHECK(web_contents);
}

Expand Down

0 comments on commit 90c2b02

Please sign in to comment.