Closed Bug 1768881 Opened 3 years ago Closed 3 years ago

Add HTML Fragments Preprocessor function to build system

Categories

(Firefox Build System :: Toolchains, enhancement)

enhancement

Tracking

(firefox102 fixed)

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: bigiri, Assigned: bigiri)

References

(Blocks 4 open bugs)

Details

Attachments

(1 file)

Implement a function in the mach build system that can be used on a per directory basis to convert XHTML files into a JS file that can load HTML fragment strings in JS. The generated JS file should take a string key and return an HTML string. It must be able to return strings that have no root element. Input XHTML files must support standard XHTML as defined in http://www.w3.org/1999/xhtml, and XUL as defined in http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul

The format for the key to retrieve the HTML strings must be consistent and easy to understand. The mach build function must take a set of XHTML files and generate this JS file with the HTML retrieval function. The generated JS file should be flexible enough to be combined with other such files if necessary, for consistent use within Firefox.

See: Bug 1768875 for details

Blocks: 1768884
Blocks: 1768886
Blocks: 1768887

Created GeneratedFile method implementing HTML Fragment Preprocessor.

Usage in a moz.build file would be as follows


GeneratedFile(
    "example.js",
    script="/python/mozbuild/mozbuild/action/html_fragment_preprocesor.py",
    entry_point="generate",
    inputs=["example_a.xhtml", "example_b.xhtml"],
)

Example XHTML files for testing are in python/mozbuild/mozbuild/test/action/data/html_fragment_preprocesor/

Attachment #9276347 - Attachment description: WIP: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor → Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor
Attachment #9276347 - Attachment description: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor → Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=standard8!
Status: NEW → ASSIGNED
Pushed by bigiri@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2ce131c8742e Created GeneratedFile method implementing HTML Fragment Preprocessor r=firefox-build-system-reviewers,glandium

Backed out for causing python failures on test_html_fragment_preprocessor.py.

Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Cretry%2Cusercancel&revision=2ce131c8742e0f0f6058a2bc980b12e4f81617ab&selectedTaskRun=U4H5aXRcRyCzwWq4cBUtsw.0

Failure log: https://treeherder.mozilla.org/logviewer?job_id=378875045&repo=autoland

Backout link: https://hg.mozilla.org/integration/autoland/rev/201e6aaf2fc800e42f668d8434b64e2749508ae0

[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py::TestNode::test_get_html_fragments_from_file_multiple_templates PASSED
[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py::TestNode::test_get_html_fragments_from_file_with_xul TEST-UNEXPECTED-FAIL
[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py::TestNode::test_get_html_fragments_from_named_template_with_html_element PASSED
[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py::TestNode::test_get_html_fragments_from_template_no_doctype_no_name PASSED
[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py::TestNode::test_get_html_fragments_from_template_with_doctype PASSED
[task 2022-05-21T18:54:56.810Z] 
[task 2022-05-21T18:54:56.810Z] =================================== FAILURES ===================================
[task 2022-05-21T18:54:56.810Z] _____________ TestNode.test_get_html_fragments_from_file_with_xul ______________
[task 2022-05-21T18:54:56.810Z] python/mozbuild/mozbuild/test/action/test_html_fragment_preprocessor.py:135: in test_get_html_fragments_from_file_with_xul
[task 2022-05-21T18:54:56.810Z]     + '<html:slot xmlns:html="http://www.w3.org/1999/xhtml" />',
[task 2022-05-21T18:54:56.810Z] E   AssertionError: '<htm[179 chars]xul" flex="1" id="label-box" part="label-box" [251 chars]" />' != '<htm[179 chars]xul" id="label-box" part="label-box" flex="1" [251 chars]" />'
[task 2022-05-21T18:54:56.811Z] E   - <html:link xmlns:html="http://www.w3.org/1999/xhtml" href="chrome://global/skin/example.css" rel="stylesheet" /><hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" id="label-box" part="label-box" role="none"><image part="icon" role="none" /><label crop="right" flex="1" id="label" part="label" role="none" /><label crop="right" flex="1" id="highlightable-label" part="label" role="none" /></hbox><html:slot xmlns:html="http://www.w3.org/1999/xhtml" />
[task 2022-05-21T18:54:56.811Z] E   + <html:link xmlns:html="http://www.w3.org/1999/xhtml" href="chrome://global/skin/example.css" rel="stylesheet" /><hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="label-box" part="label-box" flex="1" role="none"><image part="icon" role="none" /><label id="label" part="label" crop="right" flex="1" role="none" /><label id="highlightable-label" part="label" crop="right" flex="1" role="none" /></hbox><html:slot xmlns:html="http://www.w3.org/1999/xhtml" />
[task 2022-05-21T18:54:56.811Z] ========================= 1 failed, 8 passed in 0.14s ==========================
[task 2022-05-21T18:54:56.811Z] 
[task 2022-05-21T18:54:56.811Z] 
[task 2022-05-21T18:54:56.811Z] Tests Completed: 100%|██████████| 78/78 [04:23<00:00,  3.38s/Test]Return code from mach python-test: 1
[task 2022-05-21T18:54:56.861Z] 
[taskcluster 2022-05-21T18:54:56.918Z]    Exit Code: 1
[taskcluster 2022-05-21T18:54:56.918Z]    User Time: 12m51.811477s
[taskcluster 2022-05-21T18:54:56.918Z]  Kernel Time: 8m6.986146s
[taskcluster 2022-05-21T18:54:56.918Z]    Wall Time: 7m24.131431s
[taskcluster 2022-05-21T18:54:56.918Z]       Result: FAILED
[taskcluster 2022-05-21T18:54:56.918Z] === Task Finished ===
[taskcluster 2022-05-21T18:54:56.918Z] Task Duration: 7m24.136093s
[taskcluster 2022-05-21T18:54:56.918Z] [mounts] Preserving cache: Moving "/opt/worker/tasks/task_165315487733076/checkouts" to "/opt/worker/cache/OXZrN1zKQcSObWMlgApb0A"
[taskcluster 2022-05-21T18:54:56.983Z] Uploading redirect artifact public/logs/live.log to URL https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/U4H5aXRcRyCzwWq4cBUtsw/runs/0/artifacts/public%2Flogs%2Flive_backing.log with mime type "text/plain; charset=utf-8" and expiry 2023-05-21T18:46:48.214Z
[taskcluster:error] exit status 1
Flags: needinfo?(bigiri)
Attachment #9276347 - Attachment description: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=standard8! → WIP: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=standard8!
Attachment #9276347 - Attachment description: WIP: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=standard8! → WIP: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=glandium!
Flags: needinfo?(bigiri)
Attachment #9276347 - Attachment description: WIP: Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=glandium! → Bug 1768881 - Created GeneratedFile method implementing HTML Fragment Preprocessor r=glandium!
Pushed by bigiri@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/36def5ff21bf Created GeneratedFile method implementing HTML Fragment Preprocessor r=firefox-build-system-reviewers,glandium
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: