Closed Bug 1625930 Opened 5 years ago Closed 4 years ago

Use the ResourceWatcher API to fetch Stylesheets

Categories

(DevTools :: Style Editor, task, P2)

task

Tracking

(Fission Milestone:M6c, firefox80 fixed)

RESOLVED FIXED
Firefox 80
Fission Milestone M6c
Tracking Status
firefox80 --- fixed

People

(Reporter: ochameau, Assigned: daisuke)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

(Whiteboard: dt-fission-m2-mvp)

Attachments

(7 files)

Bug 1576624 introduced the ResourceWatcher API, accessible via toolbox.resourceWatcher. This API will help listen to data that is being created early, when the document just started loading.

We should migrate the whole DevTools codebase to this API for any data that:

  • DevTools frontend listen to, or care about,
    and,
  • may be created or be notified early, when the document just starts being loaded.
    This data will typically be: console messages, errors, warnings, sources, Root element NodeFront, storage values, network events, stylesheets, ...

We are typically not going to use this API for:

  • data being fetched on-demand, from user's input. For ex: webconsole evaluation input, or, DOM element expands from the Markup view.
  • events which we only want to record when the user cares about them. For ex: animation events.

For some more high level context, please have a look at Migration to Fission-compatible APIs, which describes all Fission-related refactorings.

The typical task for this bug will be about migrating code that:

  • start listening and register a RDP event listener,
  • retrieve already existings data,
    from panel's codebase, to the ResourceWatcher module, in the LegacyListener object.
    And then, the panel should use the ResourceWatcher instead.

Bug 1620234 is a good example of such migration, applied to Console Messages.
Bug 1623699 is also useful example as it demonstrates how to write tests for such migration.

This bug is about focusing on only one usecase: the StyleSheets.

StyleSheets are currently being listened via stylesheet-added, from here:
https://searchfox.org/mozilla-central/search?q=stylesheet-added&case=false&regexp=false&path=devtools%2Fclient
And already existing ones retrieved from here:
https://searchfox.org/mozilla-central/search?q=.getStyleSheets&case=false&regexp=false&path=devtools%2Fclient

We may split this bug in two:

  • addressing the style editor panel
  • migrating the source map service
Depends on: 1576624
No longer depends on: 1620234

Tracking Fission DevTools bugs for Fission Nightly (M6) milestone

Fission Milestone: --- → M6
Blocks: 1626645

Tracking dt-fission-m2-mvp bugs for Fission Nightly milestone (M6c)

Fission Milestone: M6 → M6c
Assignee: nobody → daisuke
Status: NEW → ASSIGNED

Depends on D78239

Depends on D78240

Blocks: 1644193
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a6bef105a2c2 Fire StyleSheetApplicableStateChanged event explicitly if the stylesheet is getten from the cache. r=emilio https://hg.mozilla.org/integration/autoland/rev/f63839eff636 Implement ResourceWatcher for stylesheet. r=ochameau https://hg.mozilla.org/integration/autoland/rev/1c9cf53f2a89 Apply ResourceWatcher to StyleEditor. r=ochameau https://hg.mozilla.org/integration/autoland/rev/0133d9c58323 Apply ResourceWatcher to source map. r=ochameau https://hg.mozilla.org/integration/autoland/rev/d4e4c3ddcc43 Add test ResourceWatcher for STYLESHEET type. r=ochameau https://hg.mozilla.org/integration/autoland/rev/30a3da9f613c Add test getAllResources of ResourceWatcher API. r=ochameau

Backed out 6 changesets (bug 1625930) for test_eventemitter_basic.js failures

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&searchStr=xpcshell&fromchange=63e43493e12320a84d7d20a31ceb2d8e00160868&tochange=2ac643a3f849374fa4fd63ae091e27b8220a18d6&selectedTaskRun=AEMkZyC_R-eLRk_MfDoiFw.0

Backout link: https://hg.mozilla.org/integration/autoland/rev/2ac643a3f849374fa4fd63ae091e27b8220a18d6

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=308993023&repo=autoland&lineNumber=9769

[task 2020-07-08T15:04:58.063Z] 15:04:58     INFO -  TEST-START | devtools/shared/tests/xpcshell/test_eventemitter_basic.js
[task 2020-07-08T15:04:58.410Z] 15:04:58  WARNING -  TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_eventemitter_basic.js | xpcshell return code: 0
[task 2020-07-08T15:04:58.411Z] 15:04:58     INFO -  TEST-INFO took 351ms
[task 2020-07-08T15:04:58.411Z] 15:04:58     INFO -  >>>>>>>
[task 2020-07-08T15:04:58.412Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Failed to get directory to cache.: file /builds/worker/checkouts/gecko/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp, line 121
[task 2020-07-08T15:04:58.412Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Failed to get directory to cache.: file /builds/worker/checkouts/gecko/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp, line 121
[task 2020-07-08T15:04:58.412Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Failed to get directory to cache.: file /builds/worker/checkouts/gecko/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp, line 121
[task 2020-07-08T15:04:58.413Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Failed to get directory to cache.: file /builds/worker/checkouts/gecko/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp, line 121
[task 2020-07-08T15:04:58.413Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Failed to get directory to cache.: file /builds/worker/checkouts/gecko/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp, line 121
[task 2020-07-08T15:04:58.413Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Couldn't get the user appdata directory. Crash events may not be produced.: file /builds/worker/checkouts/gecko/toolkit/crashreporter/nsExceptionHandler.cpp, line 2914
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  (xpcshell/head.js) | test run_next_test 0 pending (2)
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  (xpcshell/head.js) | test MAIN run_test finished (2)
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  running event loop
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  devtools/shared/tests/xpcshell/test_eventemitter_basic.js | Starting
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  (xpcshell/head.js) | test pending (2)
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  "testEventEmitterCreation"
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  TEST-PASS | devtools/shared/tests/xpcshell/test_eventemitter_basic.js |  - We have an event emitter - {} == true
[task 2020-07-08T15:04:58.414Z] 15:04:58  WARNING -  TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_eventemitter_basic.js |  - Event Emitter instance has the expected methods. - false == true
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  Z:/task_1594219050/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_eventemitter_basic.js:testEventEmitterCreation:27
[task 2020-07-08T15:04:58.414Z] 15:04:58     INFO -  Z:/task_1594219050/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_eventemitter_basic.js:runnable/<:355
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Z:\task_1594219050\build\tests\xpcshell\head.js:_run_next_test/<:1618
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Z:\task_1594219050\build\tests\xpcshell\head.js:_run_next_test:1618
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Z:\task_1594219050\build\tests\xpcshell\head.js:run:777
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Z:\task_1594219050\build\tests\xpcshell\head.js:_do_main:248
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Z:\task_1594219050\build\tests\xpcshell\head.js:_execute_test:577
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  -e:null:1
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  exiting test
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  (xpcshell/head.js) | test run_next_test 0 finished (2)
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Unexpected exception NS_ERROR_ABORT:
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  _abort_failed_test@Z:\task_1594219050\build\tests\xpcshell\head.js:833:20
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  do_report_result@Z:\task_1594219050\build\tests\xpcshell\head.js:934:5
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  Assert<@Z:\task_1594219050\build\tests\xpcshell\head.js:73:21
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  proto.report@resource://testing-common/Assert.jsm:233:10
[task 2020-07-08T15:04:58.415Z] 15:04:58     INFO -  proto.ok@resource://testing-common/Assert.jsm:259:10
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  testEventEmitterCreation@Z:/task_1594219050/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_eventemitter_basic.js:27:7
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  runnable/<@Z:/task_1594219050/build/tests/xpcshell/tests/devtools/shared/tests/xpcshell/test_eventemitter_basic.js:355:26
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  _run_next_test/<@Z:\task_1594219050\build\tests\xpcshell\head.js:1618:22
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  _run_next_test@Z:\task_1594219050\build\tests\xpcshell\head.js:1618:38
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  run@Z:\task_1594219050\build\tests\xpcshell\head.js:777:9
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  _do_main@Z:\task_1594219050\build\tests\xpcshell\head.js:248:6
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  _execute_test@Z:\task_1594219050\build\tests\xpcshell\head.js:577:5
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  @-e:1:1
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  exiting test
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: Extra shutdown CC: 'i < NORMAL_SHUTDOWN_COLLECTIONS', file /builds/worker/checkouts/gecko/xpcom/base/nsCycleCollector.cpp, line 3359
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: OOPDeinit() without successful OOPInit(): file /builds/worker/checkouts/gecko/toolkit/crashreporter/nsExceptionHandler.cpp, line 3359
[task 2020-07-08T15:04:58.416Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: NS_ENSURE_TRUE(Preferences::InitStaticMembers()) failed: file /builds/worker/checkouts/gecko/modules/libpref/Preferences.cpp, line 4382
[task 2020-07-08T15:04:58.417Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp, line 202
[task 2020-07-08T15:04:58.417Z] 15:04:58     INFO -  PID 11936 | [11936, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp, line 202
[task 2020-07-08T15:04:58.417Z] 15:04:58     INFO -  <<<<<<<
Flags: needinfo?(daisuke)
Flags: needinfo?(daisuke)
Pushed by dakatsuka.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6697f0e16d37 Fire StyleSheetApplicableStateChanged event explicitly if the stylesheet is getten from the cache. r=emilio https://hg.mozilla.org/integration/autoland/rev/1804cf02e1b8 Implement ResourceWatcher for stylesheet. r=ochameau https://hg.mozilla.org/integration/autoland/rev/a481df06a3d6 Apply ResourceWatcher to StyleEditor. r=ochameau https://hg.mozilla.org/integration/autoland/rev/79a78fec37d1 Apply ResourceWatcher to source map. r=ochameau https://hg.mozilla.org/integration/autoland/rev/b1d803cbd8a6 Add test ResourceWatcher for STYLESHEET type. r=ochameau https://hg.mozilla.org/integration/autoland/rev/fcddaa09a355 Add test getAllResources of ResourceWatcher API. r=ochameau https://hg.mozilla.org/integration/autoland/rev/f9da5a877d11 Add a test for count function of EventEmitter instance r=ochameau
Regressions: 1588252
Blocks: 1652647
Regressions: 1652968
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: