diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 57fb99a56db..175a061cbf4 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -380,6 +380,10 @@ impl WebGLThread { self.webrender_api.update_resources(txn.resource_updates) } + // We need to make the context current so its resources can be disposed of. + let _ = + Self::make_current_if_needed(context_id, &self.contexts, &mut self.bound_context_id); + // Release GL context. self.contexts.remove(&context_id); diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 02c4f757875..076204cd0c7 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -2694,6 +2694,13 @@ where }, }; + if let Some(old_pipeline) = self.pipelines.get(&old_pipeline_id) { + old_pipeline.notify_visibility(false); + } + if let Some(new_pipeline) = self.pipelines.get(&new_pipeline_id) { + new_pipeline.notify_visibility(true); + } + self.update_activity(old_pipeline_id); self.update_activity(new_pipeline_id); @@ -3413,6 +3420,10 @@ where self.notify_history_changed(change.top_level_browsing_context_id); }, Some(old_pipeline_id) => { + if let Some(pipeline) = self.pipelines.get(&old_pipeline_id) { + pipeline.notify_visibility(false); + } + // https://html.spec.whatwg.org/multipage/#unload-a-document self.unload_document(old_pipeline_id); // Deactivate the old pipeline, and activate the new one. diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 214ce079f44..87846e57064 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -10614,6 +10614,16 @@ {} ] ], + "mozilla/webgl/clearcolor_blue.html": [ + [ + {} + ] + ], + "mozilla/webgl/clearcolor_green.html": [ + [ + {} + ] + ], "mozilla/webgl/clearcolor_ref.html": [ [ {} @@ -20120,6 +20130,14 @@ "4760f382f0374985a334a5f6d0e0fe055670c61d", "reftest" ], + "mozilla/webgl/clearcolor_blue.html": [ + "d534babb2a664b7cb861f1cc253020e319f281e9", + "support" + ], + "mozilla/webgl/clearcolor_green.html": [ + "db11b31ab9839777d9d74cf7f2c46de00349c76e", + "support" + ], "mozilla/webgl/clearcolor_ref.html": [ "49cce2cc9009057742cb17e3fd452a986bd6c177", "support" @@ -20144,6 +20162,10 @@ "691535db4766536d66769408212cb13f3f64bef6", "testharness" ], + "mozilla/webgl/history.html": [ + "d470c229fbcca5a47d3370e8e58bae34882be491", + "testharness" + ], "mozilla/webgl/img/rust-logo-256x256.png": [ "63506dd85efce44f8433942a6f4e54d718a97046", "support" diff --git a/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_blue.html b/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_blue.html new file mode 100644 index 00000000000..d534babb2a6 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_blue.html @@ -0,0 +1,33 @@ + + + + + WebGL ClearColor Test + + + + + + + + + diff --git a/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_green.html b/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_green.html new file mode 100644 index 00000000000..db11b31ab98 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/webgl/clearcolor_green.html @@ -0,0 +1,33 @@ + + + + + WebGL ClearColor Test + + + + + + + + + diff --git a/tests/wpt/mozilla/tests/mozilla/webgl/history.html b/tests/wpt/mozilla/tests/mozilla/webgl/history.html new file mode 100644 index 00000000000..d470c229fbc --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/webgl/history.html @@ -0,0 +1,42 @@ + + +Traversing history with webgl content does not panic + + + +