Closed Bug 1809518 Opened 1 year ago Closed 1 year ago

Use JS Context to do stencil parsing in the Utility Process

Categories

(Core :: DOM: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: sefeng, Assigned: sefeng)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged][orb:m1], [wptsync upstream])

Attachments

(14 files, 1 obsolete file)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

It looks like we can get the JS context working in the utility process, so we can start to do proper Javascript parsing in the Utility Process.

This patch allows JS Validator to parse the incoming data into
stencil to verify if its a Javascript file.

Assignee: nobody → sefeng
Status: NEW → ASSIGNED
Severity: -- → N/A
Priority: -- → P2

Currently we create JSOracleParent as a singleton which won't work
if we want to have bind it one and want to bind it to a different
utility process (say the previous utility process is crashed),

Hence we create separate JSOracleParent actor for each JSValidatorParent,
so that when the utility process crashes, if the next request
successfully creates a new one, the binding can still work.

Attachment #9315261 - Attachment description: Bug 1809518 - Create a new JSOracleParent instance for each JSValidatorParent r=farre,smaug → Bug 1809518 - Recreate JSOracleParent instance when Utility Process crashes r=farre,smaug
Blocks: 1814478

Comment on attachment 9312485 [details]
Bug 1809518 - Add JSON parsing to JS Validator r=farre,smaug,tcampbell!

Revision D166946 was moved to bug 1814478. Setting attachment 9312485 [details] to obsolete.

Attachment #9312485 - Attachment is obsolete: true

Follow-up topics: The JSContext has a tempLifoAlloc cached on the JSContext that should help with malloc performance concerns. When we eventually remove the JSContext when the new Stencil APIs are landed, we'll also want to take care about this memory usage.

These tests involve a bunch of no-cors fetch requests which use
file_CrossSiteXHR_server.sjs for sending the response back.
Depends on the request's URL, the response can possibly be

  response.setHeader("Content-Type", "application/xml", false);
  response.write("<res>hello pass</res>\n");

which will make JS validator to run and blocks.

The fix here is to toggle the pref of ORB when running the tests,
so we test both with ORB and without ORB behaviors, with different
expectations.

These tests involve a bunch of no-cors fetch requests which use
file_CrossSiteXHR_server.sjs for sending the response back.
Depends on the request's URL, the response can possibly be

  response.setHeader("Content-Type", "application/xml", false);
  response.write("<res>hello pass</res>\n");

which will make JS validator to run and blocks.

The fix here is to toggle the pref of ORB when running the tests,
so we test both with ORB and without ORB behaviors, with different
expectations.

Depends on D169276

We've done some updates to this test previously when we enable
ORB (without JS validation) already. Now, we have JS validation
added and more requests are blocked, so we need to change
the expectation for more sub-tests.

Depends on D169277

This test send some cross origin no-cors requests and expect
the color of the element will be changed via CSS by reading
the response of these requests.

With ORB's JS validator is enabled, some of the requests are
going to be blocked.

This patch allows the test to test the result for both ORB
enabled and ORB disabled.

Depends on D169278

Devtools use its own mainThreadFetch to fetch resources when it's
needed. For example, fetching the content of a source file. Importantly,
these request use TYPE_OTHER which could be blocked by ORB. Having
ORB block requests coming from devtools break some of it
functionalities.

This particular request is used to identify the potential timeout issue
for HTTPS only requests. ORB doesn't need to block this request.

Depends on D170250

Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5cc0653b2072
Recreate JSOracleParent instance when Utility Process crashes r=farre
https://hg.mozilla.org/integration/autoland/rev/bf67b8c14aa0
Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell
https://hg.mozilla.org/integration/autoland/rev/25a5bf657f5c
Update test_fetch_event* related tests based on the status of the ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/d86c04497104
Update more fetch tests that use `fetch_test_framework.js` based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/16bd31105745
Update test_fetch_cors.js based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/3f43f1cd3e8b
Update test_css_cross_domain.html based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/1ddffd079624
Allow requests that are maded by devtools bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/1057c5d5a0a5
Special case the HTTPS Only timeout request to make it bypass ORB r=farre,necko-reviewers
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/38649 for changes under testing/web-platform/tests
Whiteboard: [necko-triaged][orb:m1] → [necko-triaged][orb:m1], [wptsync upstream]

Backed out for causing build bustages on JSOracleChild.h

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/workspace/obj-build/dist/include/mozilla/dom/JSOracleChild.h:77:31: error: declaration of 'static JSContext* mozilla::dom::JSOracleChild::JSContext()' [-fpermissive]
Flags: needinfo?(sefeng)
Upstream PR was closed without merging
Attachment #9311653 - Attachment description: Bug 1809518 - Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell! → Bug 1809518 - Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/678468cb98cd
Recreate JSOracleParent instance when Utility Process crashes r=farre
https://hg.mozilla.org/integration/autoland/rev/3061e4fbf237
Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell
https://hg.mozilla.org/integration/autoland/rev/3eb92dc5aac9
Update test_fetch_event* related tests based on the status of the ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/2299a5bdc7a9
Update more fetch tests that use `fetch_test_framework.js` based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/d2e6d1734eec
Update test_fetch_cors.js based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/f5add471e7f9
Update test_css_cross_domain.html based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/ce3a811a4522
Allow requests that are maded by devtools bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/b448bddfa364
Special case the HTTPS Only timeout request to make it bypass ORB r=farre,necko-reviewers

Backed out for causing fetch related failures.

Upstream PR was closed without merging

This test tests resource-timing can generate entries with cross origin
redirects, so we just need a dummy request, use empty_script.js instead to
avoid ORB stepping in.

nothing-cross-origin-corp.txt can be replaced by any other files,
because it's used a dummy file. This patch replaces it with a different
dummy file that has JS as the content, to avoid ORB blocks the request.
This doesn't change the semantic of the tests.

Depends on D170911

This test tests fetch and opaque responses, no need for
ORB to block these opaque responses.

Depends on D170912

Use a dummy JS file instead of dummy text file to avoid ORB taking
effects.

This patch should impact

  • worker-in-sandboxed-iframe-by-csp-fetch-event.https.html
  • sandboxed-iframe-fetch-event.https.html
  • opaque-response-preloaded.https.html
  • local-url-inherit-controller-frame.html

Depends on D170913

The cookie value used to be blocked by ORB which causes the
test fail, use a JS-like dummy value to avoid it's blocked
by ORB.

Depends on D170914

It doesn't look like we care this test since the test is being flaky
and lots of EXPECTED: FAIL in the ini file. Our ORB changes made it
being [OK, TIMEOUT] on non-fission platforms as well, I think it's
okay to just update the ini file to reflect that.

Depends on D170915

Created a few more patches to fix the test failures.

Flags: needinfo?(sefeng)
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/563403090c7f
Recreate JSOracleParent instance when Utility Process crashes r=farre
https://hg.mozilla.org/integration/autoland/rev/ae56071e154f
Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell
https://hg.mozilla.org/integration/autoland/rev/597cb423049d
Update test_fetch_event* related tests based on the status of the ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/c02d3f25c880
Update more fetch tests that use `fetch_test_framework.js` based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/cc88d68be920
Update test_fetch_cors.js based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/224ccbc28c49
Update test_css_cross_domain.html based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/724a5c7bba6a
Allow requests that are maded by devtools bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/b6e6065c79ff
Special case the HTTPS Only timeout request to make it bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/92b774c122c9
Fix fetch-cross-origin-redirect.https.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/85f4c2ca24e0
Replace nothing-cross-origin-corp.txt with a JS file from COEP tests r=farre
https://hg.mozilla.org/integration/autoland/rev/eda8f3ef3fdb
Fix fetch/origin/assorted.window.js for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/b1f9dcd5f147
Use a dummy JS file instead of sample.txt for some service-worker tests r=farre
https://hg.mozilla.org/integration/autoland/rev/8f77fb0ddfef
Fix the-script-element/module/credentials.sub.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/3f29ad282371
Update navigation-headers.https.html.ini r=farre
https://hg.mozilla.org/integration/autoland/rev/d245efcf2257
apply code formatting via Lando

Backed out 15 changesets (Bug 1809518) for wpt failures on navigation-headers.https.html.
Backout link
Push with failures <--> wpt3
Failure Log

Flags: needinfo?(sefeng)
Upstream PR was closed without merging

I mischanged something in a ini file. Going to try landing them again.

Flags: needinfo?(sefeng)
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b7e6300391f
Recreate JSOracleParent instance when Utility Process crashes r=farre
https://hg.mozilla.org/integration/autoland/rev/9a6b3b38f141
Use stencil parsing to do the Javascript check for ORB in Utility Process r=farre,smaug,tcampbell
https://hg.mozilla.org/integration/autoland/rev/1839f604af9b
Update test_fetch_event* related tests based on the status of the ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/72c114e55d5c
Update more fetch tests that use `fetch_test_framework.js` based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/476acd84e171
Update test_fetch_cors.js based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/2d05f87dcef7
Update test_css_cross_domain.html based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/aa4a50acfc13
Allow requests that are maded by devtools bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/e2b235e836b7
Special case the HTTPS Only timeout request to make it bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/ff881dc47051
Fix fetch-cross-origin-redirect.https.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/29720d7132cf
Replace nothing-cross-origin-corp.txt with a JS file from COEP tests r=farre
https://hg.mozilla.org/integration/autoland/rev/6cd3b5d8362b
Fix fetch/origin/assorted.window.js for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/d19285be01a8
Use a dummy JS file instead of sample.txt for some service-worker tests r=farre
https://hg.mozilla.org/integration/autoland/rev/37263ae5c4c8
Fix the-script-element/module/credentials.sub.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/767c63fa5c50
Update navigation-headers.https.html.ini r=farre
https://hg.mozilla.org/integration/autoland/rev/ef3388874d8b
apply code formatting via Lando
Regressions: 1819441
Regressions: 1819443
Regressions: 1819444
Regressions: 1819446
Upstream PR merged by moz-wptsync-bot
Regressions: 1819622
Duplicate of this bug: 1809931
Whiteboard: [necko-triaged][orb:m1], [wptsync upstream] → [necko-triaged][orb:m1], [wptsync upstream][sp3]

(In reply to Pulsebot from comment #31)

Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b7e6300391f
Recreate JSOracleParent instance when Utility Process crashes r=farre
https://hg.mozilla.org/integration/autoland/rev/9a6b3b38f141
Use stencil parsing to do the Javascript check for ORB in Utility Process
r=farre,smaug,tcampbell
https://hg.mozilla.org/integration/autoland/rev/1839f604af9b
Update test_fetch_event* related tests based on the status of the ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/72c114e55d5c
Update more fetch tests that use fetch_test_framework.js based on the
status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/476acd84e171
Update test_fetch_cors.js based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/2d05f87dcef7
Update test_css_cross_domain.html based on the status of ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/aa4a50acfc13
Allow requests that are maded by devtools bypass ORB r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/e2b235e836b7
Special case the HTTPS Only timeout request to make it bypass ORB
r=farre,necko-reviewers
https://hg.mozilla.org/integration/autoland/rev/ff881dc47051
Fix fetch-cross-origin-redirect.https.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/29720d7132cf
Replace nothing-cross-origin-corp.txt with a JS file from COEP tests r=farre
https://hg.mozilla.org/integration/autoland/rev/6cd3b5d8362b
Fix fetch/origin/assorted.window.js for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/d19285be01a8
Use a dummy JS file instead of sample.txt for some service-worker tests
r=farre
https://hg.mozilla.org/integration/autoland/rev/37263ae5c4c8
Fix the-script-element/module/credentials.sub.html for ORB r=farre
https://hg.mozilla.org/integration/autoland/rev/767c63fa5c50
Update navigation-headers.https.html.ini r=farre
https://hg.mozilla.org/integration/autoland/rev/ef3388874d8b
apply code formatting via Lando

== Change summary for alert #37574 (as of Wed, 08 Mar 2023 02:24:55 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
4% displaylist_mutate macosx1015-64-shippable-qr e10s fission stylo webrender-sw 1,898.40 -> 1,830.87
3% displaylist_mutate macosx1015-64-shippable-qr e10s fission stylo webrender-sw 1,889.88 -> 1,825.40
Whiteboard: [necko-triaged][orb:m1], [wptsync upstream][sp3] → [necko-triaged][orb:m1], [wptsync upstream]
Regressions: 1823458
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: