[meta] Stop using unnecessary type attributes (i.e. [type="application/javascript"]) on script tags
Categories
(Core :: XUL, task, P3)
Tracking
()
People
(Reporter: bgrins, Unassigned)
References
Details
(Keywords: meta)
Attachments
(5 obsolete files)
This would help tighten up test boilerplate. It'll also make migration from xul->html documents easier (although AFAICT it doesn't hurt to have the attribute on html scripts, it's kind of weird).
Comment 1•6 years ago
|
||
Looking at XULContentSinkImpl::OpenScript it seems like no type attr will cause isJavaScript to be true. That's basically the HTML behavior too: type defaults to "javascript" if no type specified.
So I'm not sure we even need any Gecko-side changes here, just changes to the <script> tags in XUL documents.
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #1)
Looking at XULContentSinkImpl::OpenScript it seems like no type attr will cause isJavaScript to be true. That's basically the HTML behavior too: type defaults to "javascript" if no type specified.
So I'm not sure we even need any Gecko-side changes here, just changes to the <script> tags in XUL documents.
Huh, that'll make things easier then. Working on a script to convert the frontend. By the way, is it the same story with type="text/javascript"
?
Comment 3•6 years ago
|
||
Yes. Basically, for our purposes there are only three different things you can stick in the type attr:
- No attr at all: it's javascript
- It's something in the list at https://searchfox.org/mozilla-central/rev/8d78f219702286c873860f39f9ed78bad1a6d062/dom/base/nsContentUtils.cpp#6994-7009: it's javascript
- It's something else: not javascript, do not run.
Reporter | ||
Comment 4•6 years ago
|
||
From that list, I see hits for the following types in documents in the tree:
"text/javascript",
"text/ecmascript",
"application/javascript",
"application/ecmascript",
"application/x-javascript",
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 5•6 years ago
|
||
First attempt at a script for generating this change
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 6•6 years ago
|
||
The patch is too large to upload to phab or splinter [10574 files changed, 26853 insertions(+), 28941 deletions(-)], but here it is: https://raw.githubusercontent.com/bgrins/firefox-patches/master/bug_1542877_scripted_change_to_replace_unnecessary_type_attributes_on_scrip.
Comment 7•6 years ago
|
||
It's worth checking whether any of the test files being modified were testing the type attribute....
Reporter | ||
Comment 8•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #7)
It's worth checking whether any of the test files being modified were testing the type attribute....
Yeah, that makes sense. I can't think of a good way off-hand to assert that, but will think about it some more. I did exclude wpt from the script, under the assumption that there would be such tests there. In the meantime I've sent a notice to dev-platform and maybe someone on there will know of any tests that do this.
Updated•6 years ago
|
Reporter | ||
Comment 9•6 years ago
|
||
Updated script that includes paths in ThirdPartyPaths.txt and .gitignore, and also allows for turning off particular directories. Also better chunking of args into the actual replacement command.
Reporter | ||
Comment 10•6 years ago
|
||
Reporter | ||
Comment 11•6 years ago
|
||
This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.
ignore-this-changeset
Reporter | ||
Comment 12•6 years ago
|
||
Part 2 was generated with this script
Comment 13•6 years ago
|
||
Comment on attachment 9057091 [details]
Bug 1542877 - Part 1 - Update ./mach addtest
templates to stop using [type] attribute on script tags
Revision D26811 was moved to bug 1543300. Setting attachment 9057091 [details] to obsolete.
Updated•6 years ago
|
Comment 14•6 years ago
|
||
Comment on attachment 9057092 [details]
Bug 1542877 - Part 1 - Remove the [type] attribute for one-liner <script> tags loading files in chrome://mochikit/content/
Revision D26812 was moved to bug 1544322. Setting attachment 9057092 [details] to obsolete.
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Updated•2 years ago
|
Description
•