diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-05-05 04:40:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 04:40:51 -0400 |
commit | 5e44327325cdc92dffa40b92394e8b2b68df97e0 (patch) | |
tree | 15c4b022f218ea9a8d0f14262520cc7fd477b713 /components/script/dom/document.rs | |
parent | 173bfadaa75d35e88bb5f51fbff56ab9caaae552 (diff) | |
parent | 86a5cf75aa4b67ded34eaecc0b3eda3d78e47b24 (diff) | |
download | servo-5e44327325cdc92dffa40b92394e8b2b68df97e0.tar.gz servo-5e44327325cdc92dffa40b92394e8b2b68df97e0.zip |
Auto merge of #26410 - utsavoza:ugo/issue-26287/04-05-2020, r=ferjm
Update window.open() to return fallible result
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes partially fix #26287
- [x] There are tests for these changes
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 3606ffc7c9d..eacd6a11745 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -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 |