Bug 1767829 - Part 2: Give ScriptLoaderInterface a virtual destructor r=yulia

Classes with virtual methods should have a virtual destructor so deleting an
object through a base class pointer works correctly. I think I got lint
warnings about this when I added a new derived loader.

Differential Revision: https://phabricator.services.mozilla.com/D145489
This commit is contained in:
Jon Coppeard 2022-05-09 11:06:25 +00:00
parent 39651f8671
commit 1e506ccabd
2 changed files with 3 additions and 1 deletions

View File

@ -433,7 +433,7 @@ class ScriptLoader final : public JS::loader::ScriptLoaderInterface {
nsIURI* GetBaseURI() const override;
private:
virtual ~ScriptLoader();
~ScriptLoader();
already_AddRefed<ScriptLoadRequest> CreateLoadRequest(
ScriptKind aKind, nsIURI* aURI, nsIScriptElement* aElement,

View File

@ -57,6 +57,8 @@ class ScriptLoaderInterface : public nsISupports {
using ScriptLoadRequestList = JS::loader::ScriptLoadRequestList;
using ModuleLoadRequest = JS::loader::ModuleLoadRequest;
virtual ~ScriptLoaderInterface() = default;
// In some environments, we will need to default to a base URI
virtual nsIURI* GetBaseURI() const = 0;