@@ -7,6 +7,7 @@ export const BACKGROUND_COLOR_START = 'rgba(85, 127, 243, 0.10)';
77export  const  BACKGROUND_COLOR_END  =  'rgba(85, 127, 243, 0.25)' ; 
88export  const  OVERLAY_ID  =  'ddg-password-import-overlay' ; 
99export  const  DELAY_BEFORE_ANIMATION  =  300 ; 
10+ const  BOOKMARK_IMPORT_DOMAIN  =  'takeout.google.com' ; 
1011
1112/** 
1213 * @typedef  ButtonAnimationStyle 
@@ -403,23 +404,40 @@ export default class AutofillPasswordImport extends ContentFeature {
403404        return  [ this . #exportButtonSettings?. path ,  this . #settingsButtonSettings?. path ,  this . #signInButtonSettings?. path ] . includes ( path ) ; 
404405    } 
405406
406-     async  handlePath ( path )  { 
407+     async  handlePasswordManagerPath ( pathname )  { 
408+         console . log ( 'DEEP DEBUG autofill-password-import: handlePasswordManagerPath' ,  pathname ) ; 
407409        this . removeOverlayIfNeeded ( ) ; 
408-         if  ( this . isSupportedPath ( path ) )  { 
410+         if  ( this . isSupportedPath ( pathname ) )  { 
409411            try  { 
410-                 this . setCurrentElementConfig ( await  this . getElementAndStyleFromPath ( path ) ) ; 
412+                 this . setCurrentElementConfig ( await  this . getElementAndStyleFromPath ( pathname ) ) ; 
411413                if  ( this . currentElementConfig ?. element  &&  ! this . #tappedElements. has ( this . currentElementConfig ?. element ) )  { 
412414                    await  this . animateOrTapElement ( ) ; 
413415                    if  ( this . currentElementConfig ?. shouldTap  &&  this . currentElementConfig ?. tapOnce )  { 
414416                        this . #tappedElements. add ( this . currentElementConfig . element ) ; 
415417                    } 
416418                } 
417419            }  catch  { 
418-                 console . error ( 'password-import: failed for path:' ,  path ) ; 
420+                 console . error ( 'password-import: failed for path:' ,  pathname ) ; 
419421            } 
420422        } 
421423    } 
422424
425+     handleBookmarkImportPath ( pathname )  { 
426+         console . log ( 'DEEP DEBUG autofill-password-import: handleBookmarkImportPath' ,  pathname ) ; 
427+     } 
428+ 
429+     /** 
430+      * @param  {Location } location 
431+      */ 
432+     async  handleLocation ( location )  { 
433+         const  {  pathname,  hostname }  =  location ; 
434+         if  ( hostname  ===  BOOKMARK_IMPORT_DOMAIN )  { 
435+             this . handleBookmarkImportPath ( pathname ) ; 
436+         }  else  { 
437+             await  this . handlePasswordManagerPath ( pathname ) ; 
438+         } 
439+     } 
440+ 
423441    /** 
424442     * Based on the current element config, animates the element or taps it. 
425443     * If the element should be watched for removal, it sets up a mutation observer. 
@@ -491,16 +509,17 @@ export default class AutofillPasswordImport extends ContentFeature {
491509    } 
492510
493511    urlChanged ( )  { 
494-         this . handlePath ( window . location . pathname ) ; 
512+         this . handleLocation ( window . location ) ; 
495513    } 
496514
497515    init ( )  { 
516+         console . log ( 'DEEP DEBUG autofill-password-import: init' ) ; 
498517        if  ( isBeingFramed ( ) )  { 
499518            return ; 
500519        } 
501-         this . setButtonSettings ( ) ; 
502520
503-         const  handlePath  =  this . handlePath . bind ( this ) ; 
521+         this . setButtonSettings ( ) ; 
522+         const  handleLocation  =  this . handleLocation . bind ( this ) ; 
504523
505524        this . #domLoaded =  new  Promise ( ( resolve )  =>  { 
506525            if  ( document . readyState  !==  'loading' )  { 
@@ -514,8 +533,7 @@ export default class AutofillPasswordImport extends ContentFeature {
514533                async  ( )  =>  { 
515534                    // @ts -expect-error - caller doesn't expect a value here 
516535                    resolve ( ) ; 
517-                     const  path  =  window . location . pathname ; 
518-                     await  handlePath ( path ) ; 
536+                     await  handleLocation ( window . location ) ; 
519537                } , 
520538                {  once : true  } , 
521539            ) ; 
0 commit comments