(In reply to :Gijs (he/him) from comment #6) > mozregression says this regressed with https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a8d37f94a6364103b7f373b9938ce7a62d9db9e6&tochange=5b0962239a45c0cdae5d495e8ee3786a7c5a07f3 though I wonder if the `requestIdleCallback` based testcase is racy. > > Also I don't see anything obvious in that pushlog. :-( The data uri test case is very racy and is not useful for bisecting > In some further testing I'm struggling to consistently reproduce things - is the trick here that things are only exposed once some chrome actor accesses the thing in question, or something? In testing locally, using something like `function(){}` as the event listener callback still results in the interface being exposed to web content. Removing the `addEventListener` call results in the interface not being exposed to web content. > that is, I'm trying to use e.g. typeof StyleSheetApplicableStateChangeEvent and that still produces undefined in most cases, but the attached testcase does notice when I open devtools. How does that work, exactly? - `StyleSheetApplicableStateChanged` events fire when stylesheets are constructed by JS https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#139 https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#297-332 - DevTools is the only consumer of these events - `StyleSheetApplicableStateChangeEvent` gets exposed to web content when this callback runs at least once https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/devtools/server/actors/utils/stylesheets-manager.js#104-107 So, the test case constructs a stylesheets and checks `"StyleSheetApplicableStateChangeEvent" in window`. This ends up being a reliable way to detect that DevTools has been opened.
Bug 1906744 Comment 8 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to :Gijs (he/him) from comment #6) > mozregression says this regressed with https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a8d37f94a6364103b7f373b9938ce7a62d9db9e6&tochange=5b0962239a45c0cdae5d495e8ee3786a7c5a07f3 though I wonder if the `requestIdleCallback` based testcase is racy. > > Also I don't see anything obvious in that pushlog. :-( The data uri test case is very racy and is not useful for bisecting > In some further testing I'm struggling to consistently reproduce things - is the trick here that things are only exposed once some chrome actor accesses the thing in question, or something? In testing locally, using something like `function(){}` as the event listener callback still results in the interface being exposed to web content. Removing the `addEventListener` call results in the interface not being exposed to web content. > that is, I'm trying to use e.g. typeof StyleSheetApplicableStateChangeEvent and that still produces undefined in most cases, but the attached testcase does notice when I open devtools. How does that work, exactly? - `StyleSheetApplicableStateChanged` events fire when stylesheets are constructed by JS https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#139 https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#297-332 - DevTools is the only consumer of these events - `StyleSheetApplicableStateChangeEvent` gets exposed to web content when this callback runs at least once https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/devtools/server/actors/utils/stylesheets-manager.js#104-107 So, the test case constructs a stylesheet and checks `"StyleSheetApplicableStateChangeEvent" in window`. This ends up being a reliable way to detect that DevTools has been opened.
(In reply to :Gijs (he/him) from comment #6) > mozregression says this regressed with https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a8d37f94a6364103b7f373b9938ce7a62d9db9e6&tochange=5b0962239a45c0cdae5d495e8ee3786a7c5a07f3 though I wonder if the `requestIdleCallback` based testcase is racy. > > Also I don't see anything obvious in that pushlog. :-( The data uri test case is very racy and is not useful for bisecting > In some further testing I'm struggling to consistently reproduce things - is the trick here that things are only exposed once some chrome actor accesses the thing in question, or something? In testing locally, using something like `function(){}` as the event listener callback still results in the interface being exposed to web content. Removing the `addEventListener` call results in the interface not being exposed to web content. > that is, I'm trying to use e.g. typeof StyleSheetApplicableStateChangeEvent and that still produces undefined in most cases, but the attached testcase does notice when I open devtools. How does that work, exactly? - `StyleSheetApplicableStateChanged` events fire when stylesheets are constructed by JS https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#139 https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/layout/style/StyleSheet.cpp#297-353 - DevTools is the only consumer of these events - `StyleSheetApplicableStateChangeEvent` gets exposed to web content when this callback runs at least once https://searchfox.org/mozilla-central/rev/4a78812619a63c4ace10ff4269432f73b64d5d67/devtools/server/actors/utils/stylesheets-manager.js#104-107 So, the test case constructs a stylesheet and checks `"StyleSheetApplicableStateChangeEvent" in window`. This ends up being a reliable way to detect that DevTools has been opened.