Bug 1440407 P2 Remove some unnecessary nsPIDOMWindowInner QI to nsIGlobalObject. r=mystor

This commit is contained in:
Ben Kelly
2018-02-22 14:28:39 -08:00
parent 6330e7323d
commit d1e74e121d
18 changed files with 65 additions and 93 deletions

View File

@@ -2704,11 +2704,10 @@ HTMLMediaElement::SeekToNextFrame(ErrorResult& aRv)
/* This will cause JIT code to be kept around longer, to help performance
* when using SeekToNextFrame to iterate through every frame of a video.
*/
nsCOMPtr<nsIGlobalObject> global =
do_QueryInterface(OwnerDoc()->GetInnerWindow());
nsPIDOMWindowInner* win = OwnerDoc()->GetInnerWindow();
if (global) {
if (JSObject *obj = global->GetGlobalJSObject()) {
if (win) {
if (JSObject *obj = win->AsGlobal()->GetGlobalJSObject()) {
js::NotifyAnimationActivity(obj);
}
}
@@ -7110,13 +7109,12 @@ HTMLMediaElement::SetMediaKeys(mozilla::dom::MediaKeys* aMediaKeys,
return nullptr;
}
nsCOMPtr<nsIGlobalObject> global =
do_QueryInterface(OwnerDoc()->GetInnerWindow());
if (!global) {
nsPIDOMWindowInner* win = OwnerDoc()->GetInnerWindow();
if (!win) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
RefPtr<DetailedPromise> promise = DetailedPromise::Create(global, aRv,
RefPtr<DetailedPromise> promise = DetailedPromise::Create(win->AsGlobal(), aRv,
NS_LITERAL_CSTRING("HTMLMediaElement.setMediaKeys"));
if (aRv.Failed()) {
return nullptr;
@@ -7607,14 +7605,14 @@ HTMLMediaElement::NotifyAboutPlaying()
already_AddRefed<Promise>
HTMLMediaElement::CreateDOMPromise(ErrorResult& aRv) const
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(OwnerDoc()->GetInnerWindow());
nsPIDOMWindowInner* win = OwnerDoc()->GetInnerWindow();
if (!global) {
if (!win) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
return Promise::Create(global, aRv);
return Promise::Create(win->AsGlobal(), aRv);
}
void