Closed Bug 1603554 Opened 6 years ago Closed 6 years ago

Remove XULElement.align, replace with getAttribute/setAttribute

Categories

(Core :: XUL, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: bytesized, Assigned: bytesized)

References

(Blocks 1 open bug)

Details

(Whiteboard: [no thunderbird impact])

Attachments

(3 files)

Some preliminary testing suggests that this is an easy one to knock out. We just need to remove the webidl and C++ implementation and convert a small handful of consumers to using getAttribute and setAttribute.

Magnus, we are starting the process of removing the XUL "magic attributes" as outlined in https://groups.google.com/d/msg/firefox-dev/UuJISQiok38/I52n8tBlBgAJ. You'll need to update the TB frontend as well, since we will be removing support from webidl for the XUL element properties.

Kirk, I believe you have a script you've been using to generate these patches. Would you mind sharing a link to it?

Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(ksteuber)
Attached file prop_to_attr.py3

Here is the current version of the script I've been using. There are probably a couple of things I should note about it.

The script should be given a property name to replace and a repository to do it in. It will make changes directly to that repository. You probably want to start with a clean repository so you don't mix auto-generated changes with your own.

Typical usage looks like: ./prop_to_attr.py3 align /c/mozilla-central/ or python3 prop_to_attr.py3 align /c/mozilla-central/

The script has some prerequisites:

I've only tested this on my own machine. I can't make any guarantees about how this will run on other OS's and with other configurations.

If you are running this on Windows, like I am, you might want to turn off "Realtime threat and virus protection" before you run this. In my experience, this will make ripgrep run much, much faster.

The tool is unable to make any kind of contextual determination regarding whether the replacement makes sense in any particular file. You probably want to look through the changes it makes and make sure they look reasonable. The script will use the .gitignore and ThirdPartyPaths.txt files in the repository to avoid changing files it shouldn't, but it still can't differentiate between, for example, a JS class with a property called align and usage of XULElement.align.

Flags: needinfo?(ksteuber)

Thanks Kirk. FYI I've also been looking at options for using tools that work on ASTs to make it more robust (jscodeshift, xpcshell+Reflect.jsm, eslint). But don't have anything working tree-wide. In particular, getting them to work on xhtml/html files seems to take some work. So, this python script along with manual fixups seems like a good solution for the handful of "magic attributes".

Thanks Kirk, Brian! Got the script working on linux too.
For this particular bug, seems there's nothing to do for Thunderbird, but it will be useful for the other similar cases.

Flags: needinfo?(mkmelin+mozilla)
Whiteboard: [no thunderbird impact]
Pushed by ksteuber@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/df2b0ec27d5e Remove XULElement.align from webidl and c++ r=bzbarsky https://hg.mozilla.org/integration/autoland/rev/8a5deb3cee4c Replace XULElement.align with getAttribute/setAttribute r=bgrins
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: