mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Update window.open() to return fallible result
This commit is contained in:
parent
0b05b5ed87
commit
86a5cf75aa
7 changed files with 15 additions and 137 deletions
|
@ -4685,14 +4685,10 @@ impl DocumentMethods for Document {
|
|||
url: USVString,
|
||||
target: DOMString,
|
||||
features: DOMString,
|
||||
) -> Fallible<DomRoot<WindowProxy>> {
|
||||
// WhatWG spec states this should always return a WindowProxy, but the spec for WindowProxy.open states
|
||||
// it optionally returns a WindowProxy. Assume an error if window.open returns none.
|
||||
// See https://github.com/whatwg/html/issues/4091
|
||||
let context = self.browsing_context().ok_or(Error::InvalidAccess)?;
|
||||
context
|
||||
) -> Fallible<Option<DomRoot<WindowProxy>>> {
|
||||
self.browsing_context()
|
||||
.ok_or(Error::InvalidAccess)?
|
||||
.open(url, target, features)
|
||||
.ok_or(Error::InvalidAccess)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-document-write
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue