Closed Bug 1415270 Opened 7 years ago Closed 6 years ago

Consider moving execCommand, queryCommand* and designMode from HTMLDocument to Document

Categories

(Core :: DOM: Core & HTML, defect, P3)

53 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: bzbarsky, Assigned: ehsan.akhgari)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(4 files)

Attached file Testcase
It's there on Document in other browsers (Edge, Safari, Chrome).
Depends on: 1415275
Priority: -- → P3
Blocks: 897815
Component: DOM → DOM: Core & HTML

I have a patch set for all of these together since the underlying code is hard to disentangle.

Assignee: nobody → ehsan
Keywords: site-compat
Summary: Consider moving queryCommand* from HTMLDocument to Document → Consider moving execCommand, queryCommand* and designMode from HTMLDocument to Document
No longer depends on: 1415275

This is similar to this Chromium change:
https://codereview.chromium.org/1155353002

The editing spec doesn't mention editing non-HTML documents, and historically
this is only a feature that WebKit has supported. Supporting this feature
increases the attack surface of the browser without a clear benefit, so it
seems like a good idea to converge on this behaviour.

Blocks: 836176
Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7910719718f4 Part 1: Move nsHTMLDocument editing APIs to Document; r=farre,masayuki https://hg.mozilla.org/integration/autoland/rev/060d26dc9d2f Part 2: Enable editing support for non-HTML documents as well; r=masayuki https://hg.mozilla.org/integration/autoland/rev/9b8cf182a743 Part 3: Prevent the editing APIs from being called on non-HTML documents; r=masayuki
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/17116 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.

I suspect that on win7, this has triggered loading msctf.dll when running xperf (it shows up in the IO instrumentation that that talos test runs), where we didn't do so before. I came across this in https://bugzilla.mozilla.org/show_bug.cgi?id=1559878#c6 . I'm not yet sure whether this bug or the e10s pgo changes were responsible for the startup IO regression on win7 there (a whole range of builds is busted so it's hard to tell), but it seemed worth asking either way whether the additional dll load is expected and/or whether there's optimization we can do here to avoid that?

Flags: needinfo?(ehsan)

(In reply to :Gijs (he/him) from comment #12)

I suspect that on win7, this has triggered loading msctf.dll when running xperf (it shows up in the IO instrumentation that that talos test runs), where we didn't do so before. I came across this in https://bugzilla.mozilla.org/show_bug.cgi?id=1559878#c6 . I'm not yet sure whether this bug or the e10s pgo changes were responsible for the startup IO regression on win7 there (a whole range of builds is busted so it's hard to tell), but it seemed worth asking either way whether the additional dll load is expected and/or whether there's optimization we can do here to avoid that?

Hmm, that is very strange. Definitely not something that I expected. Looking at our code it seems like we use msctf.dll for IME handling, and we try to see if it's loaded using GetModuleHandleEx but I'm not sure where else we call these functions from. Masayuki, perhaps you would know?

In thoery at least, what this bug did should not have caused any new code to be executed where it wouldn't have been before, and if that's not the case then we have a bug on our hands...

Flags: needinfo?(ehsan) → needinfo?(masayuki)

FWIW, I trypushed from recent-ish central in https://bugzilla.mozilla.org/show_bug.cgi?id=1559878#c9 to see if this was the e10s-for-pgo change's fault, and neither log (ie neither central nor central with the use-e10s-for-pgo stuff backed out) has it now... so either the load has disappeared since then (ie something else has fixed that particular oddity) or it's intermittent (in which case it may or may not be correlated to this patch, depending on whether it happened before or not, which we don't know). Given that this tidbit might still be interesting (perhaps irrespective of whether it's actually caused by this bug), I'll leave ni's intact on this bug.

It's called at first nsWindow::Create() call. I think that it's necessary to be done before first widget gets focus since it's used to setting input context for IME and keyboards. For example, the information is used by touch keyboard to consider using normal mode, URL mode and password mode.

Flags: needinfo?(masayuki)

Hmm, but we don't load the DLL from there, right? Only try to access it if it's already loaded...

(In reply to :Ehsan Akhgari from comment #16)

Hmm, but we don't load the DLL from there, right? Only try to access it if it's already loaded...

In my understanding, GetModuleHandleExW() loads DLL if specified one hasn't been loaded yet.

And I think that this cost is not so important because IIRC, this path runs only on Windows Server or something which TSF hasn't been installed into. Even on Win7 for en-US, TSF is installed and enabled for "Tablet PC Input Panel" so that the fallback path won't be used in actual users' environment.

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(I'm back, but still struggling with the pain) from comment #17)

(In reply to :Ehsan Akhgari from comment #16)

Hmm, but we don't load the DLL from there, right? Only try to access it if it's already loaded...

In my understanding, GetModuleHandleExW() loads DLL if specified one hasn't been loaded yet.

No, see https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandlew. This function only returns a handle to an already loaded module without incrementing the module's refcount. If the module hans't been loaded yet, it will return NULL.

And I think that this cost is not so important because IIRC, this path runs only on Windows Server or something which TSF hasn't been installed into. Even on Win7 for en-US, TSF is installed and enabled for "Tablet PC Input Panel" so that the fallback path won't be used in actual users' environment.

I see. So I think the actual loading of the DLL probably happens in some other code entirely, most likely in some Windows code that we call into and isn't something we could easily find by looking through searchfox. :-/

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: