mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Add additional debugging closest bug
Use the topic "error.web-team" - error prefix necessary
for it to be treated as an error, and 'web-team' moves
it off main channel.
Error logs tagName and nodeType which should be sufficient
for us to understand this issue. Can expand with other
information later if need be. Cannot add to stack trace
as any non-standard stack trace would be dropped by the intake
code.
Bug: T340081
Change-Id: Ia011aaf9f8b5b932695da3311f849682c0105cfe
(cherry picked from commit a80d2b1f56
)
This commit is contained in:
parent
6b659443b5
commit
4507ee5207
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
31
src/index.js
31
src/index.js
|
@ -135,17 +135,30 @@ function registerChangeListeners(
|
|||
*/
|
||||
function handleDOMEventIfEligible( handler ) {
|
||||
return function ( event ) {
|
||||
// if the element is a text node, as events can be triggered on text nodes
|
||||
// it won't have a closest method, so we get its parent element (T340081)
|
||||
if ( event.target.nodeType === 3 ) {
|
||||
event.target = event.target.parentNode;
|
||||
}
|
||||
// If the event bubbles up all the way,
|
||||
// document does not have closest method, so exit early (T336650).
|
||||
if ( event.target === document ) {
|
||||
let target = event && event.target;
|
||||
if ( !target ) {
|
||||
return;
|
||||
}
|
||||
const target = findNearestEligibleTarget( event.target );
|
||||
// if the element is a text node, as events can be triggered on text nodes
|
||||
// it won't have a closest method, so we get its parent element (T340081)
|
||||
if ( target.nodeType === 3 ) {
|
||||
target = target.parentNode;
|
||||
}
|
||||
|
||||
// If the closest method is not defined, let's return early and
|
||||
// understand this better by logging an error. (T340081)
|
||||
if ( target && !target.closest ) {
|
||||
const err = new Error( `T340081: Unexpected DOM element ${target.tagName} with nodeType ${target.nodeType}` );
|
||||
mw.errorLogger.logError( err, 'error.web-team' );
|
||||
return;
|
||||
}
|
||||
|
||||
// If the event bubbles up all the way,
|
||||
// document does not have closest method, so exit early (T336650).
|
||||
if ( target === document ) {
|
||||
return;
|
||||
}
|
||||
target = findNearestEligibleTarget( target );
|
||||
if ( target === null ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ module.exports = ( env, argv ) => ( {
|
|||
// Minified uncompressed size limits for chunks / assets and entrypoints. Keep these numbers
|
||||
// up-to-date and rounded to the nearest 10th of a kibibyte so that code sizing costs are
|
||||
// well understood. Related to bundlesize minified, gzipped compressed file size tests.
|
||||
maxAssetSize: 46.4 * 1024,
|
||||
maxEntrypointSize: 46.4 * 1024,
|
||||
maxAssetSize: 46.5 * 1024,
|
||||
maxEntrypointSize: 46.5 * 1024,
|
||||
|
||||
// The default filter excludes map files but we rename ours.
|
||||
assetFilter: ( filename ) => !filename.endsWith( srcMapExt )
|
||||
|
|
Loading…
Reference in a new issue