[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-153.2.0esr-16.0-1] Bug 2052011 - Remove inline JS from about:config in GeckoView. r=geckoview-reviewers,nalexander



Title: GitLab

Dan Ballard pushed to branch tor-browser-153.2.0esr-16.0-1 at The Tor Project / Applications / Tor Browser

Commits:

  • c76b89e2
    by Tom Schuster at 2026-09-03T14:34:52-07:00
    Bug 2052011 - Remove inline JS from about:config in GeckoView. r=geckoview-reviewers,nalexander
    
    Differential Revision: https://phabricator.services.mozilla.com/D310051
    

2 changed files:

Changes:

  • mobile/shared/chrome/geckoview/config.js
    ... ... @@ -73,6 +73,28 @@ var NewPrefDialog = {
    73 73
         this._intValue = document.getElementById("new-pref-value-int");
    
    74 74
     
    
    75 75
         this._positiveButton = document.getElementById("positive-button");
    
    76
    +
    
    77
    +    document
    
    78
    +      .getElementById("new-pref-toggle-button")
    
    79
    +      .addEventListener("click", () => this.toggleShowHide());
    
    80
    +    document
    
    81
    +      .getElementById("pref-toggle-button")
    
    82
    +      .addEventListener("click", () => this.toggleBoolValue());
    
    83
    +    document
    
    84
    +      .getElementById("negative-button")
    
    85
    +      .addEventListener("click", () => this.hide());
    
    86
    +    this._positiveButton.addEventListener("click", () => this.create());
    
    87
    +
    
    88
    +    this._prefNameInputElt.addEventListener("focus", event =>
    
    89
    +      this.focusName(event)
    
    90
    +    );
    
    91
    +    this._prefNameInputElt.addEventListener("input", event =>
    
    92
    +      this.updateName(event)
    
    93
    +    );
    
    94
    +
    
    95
    +    this._prefTypeSelectElt.addEventListener("change", event => {
    
    96
    +      this.type = event.target.value;
    
    97
    +    });
    
    76 98
       },
    
    77 99
     
    
    78 100
       // Called to update positive button to display text ("Create"/"Change), and enabled/disabled status
    
    ... ... @@ -235,6 +257,21 @@ var AboutConfig = {
    235 257
     
    
    236 258
         // Setup the prefs observers
    
    237 259
         Services.prefs.addObserver("", this);
    
    260
    +
    
    261
    +    this.filterInput.addEventListener("input", () =>
    
    262
    +      AboutConfig.bufferFilterInput()
    
    263
    +    );
    
    264
    +
    
    265
    +    document.getElementById("content").addEventListener("touchstart", () => {
    
    266
    +      this.filterInput.blur();
    
    267
    +    });
    
    268
    +
    
    269
    +    document
    
    270
    +      .getElementById("copy-pref-name")
    
    271
    +      .addEventListener("click", () => this.clipboardCopy("name"));
    
    272
    +    document
    
    273
    +      .getElementById("copy-pref-value")
    
    274
    +      .addEventListener("click", () => this.clipboardCopy("value"));
    
    238 275
       },
    
    239 276
     
    
    240 277
       // Uninit the main AboutConfig dialog
    
    ... ... @@ -711,3 +748,12 @@ Pref.prototype = {
    711 748
         }
    
    712 749
       },
    
    713 750
     };
    
    751
    +
    
    752
    +window.addEventListener("load", () => {
    
    753
    +  NewPrefDialog.init();
    
    754
    +  AboutConfig.init();
    
    755
    +});
    
    756
    +
    
    757
    +window.addEventListener("unload", () => {
    
    758
    +  AboutConfig.uninit();
    
    759
    +});

  • mobile/shared/chrome/geckoview/config.xhtml
    ... ... @@ -24,19 +24,10 @@
    24 24
         ></script>
    
    25 25
       </head>
    
    26 26
     
    
    27
    -  <body
    
    28
    -    _onload_="
    
    29
    -      NewPrefDialog.init();
    
    30
    -      AboutConfig.init();
    
    31
    -    "
    
    32
    -    _onunload_="AboutConfig.uninit()"
    
    33
    -  >
    
    27
    +  <body>
    
    34 28
         <div class="toolbar">
    
    35 29
           <div class="toolbar-container">
    
    36
    -        <div
    
    37
    -          id="new-pref-toggle-button"
    
    38
    -          _onclick_="NewPrefDialog.toggleShowHide()"
    
    39
    -        />
    
    30
    +        <div id="new-pref-toggle-button" />
    
    40 31
     
    
    41 32
             <div class="toolbar-item" id="filter-container">
    
    42 33
               <div id="filter-search-button" />
    
    ... ... @@ -45,13 +36,12 @@
    45 36
                 type="search"
    
    46 37
                 data-l10n-id="config-toolbar-search"
    
    47 38
                 value=""
    
    48
    -            _oninput_="AboutConfig.bufferFilterInput()"
    
    49 39
               />
    
    50 40
             </div>
    
    51 41
           </div>
    
    52 42
         </div>
    
    53 43
     
    
    54
    -    <div id="content" _ontouchstart_="AboutConfig.filterInput.blur();">
    
    44
    +    <div id="content">
    
    55 45
           <div id="new-pref-container">
    
    56 46
             <li class="pref-item" id="new-pref-item">
    
    57 47
               <div class="pref-item-line">
    
    ... ... @@ -60,13 +50,8 @@
    60 50
                   id="new-pref-name"
    
    61 51
                   type="text"
    
    62 52
                   data-l10n-id="config-new-pref-name"
    
    63
    -              _onfocus_="NewPrefDialog.focusName(event)"
    
    64
    -              _oninput_="NewPrefDialog.updateName(event)"
    
    65 53
                 />
    
    66
    -            <select
    
    67
    -              id="new-pref-type"
    
    68
    -              _onchange_="NewPrefDialog.type = event.target.value"
    
    69
    -            >
    
    54
    +            <select id="new-pref-type">
    
    70 55
                   <option
    
    71 56
                     value="boolean"
    
    72 57
                     data-l10n-id="config-new-pref-value-boolean"
    
    ... ... @@ -90,7 +75,7 @@
    90 75
                 />
    
    91 76
                 <div
    
    92 77
                   class="pref-button toggle"
    
    93
    -              _onclick_="NewPrefDialog.toggleBoolValue()"
    
    78
    +              id="pref-toggle-button"
    
    94 79
                   data-l10n-id="config-pref-toggle-button"
    
    95 80
                 ></div>
    
    96 81
               </div>
    
    ... ... @@ -113,13 +98,11 @@
    113 98
                 <div
    
    114 99
                   class="pref-button cancel"
    
    115 100
                   id="negative-button"
    
    116
    -              _onclick_="NewPrefDialog.hide()"
    
    117 101
                   data-l10n-id="config-new-pref-cancel-button"
    
    118 102
                 ></div>
    
    119 103
                 <div
    
    120 104
                   class="pref-button create"
    
    121 105
                   id="positive-button"
    
    122
    -              _onclick_="NewPrefDialog.create(event)"
    
    123 106
                   data-l10n-id="config-new-pref-create-button"
    
    124 107
                 ></div>
    
    125 108
               </div>
    
    ... ... @@ -135,12 +118,12 @@
    135 118
     
    
    136 119
         <menu type="context" id="prefs-context-menu">
    
    137 120
           <menuitem
    
    121
    +        id="copy-pref-name"
    
    138 122
             data-l10n-id="config-context-menu-copy-pref-name"
    
    139
    -        _onclick_="AboutConfig.clipboardCopy('name')"
    
    140 123
           ></menuitem>
    
    141 124
           <menuitem
    
    125
    +        id="copy-pref-value"
    
    142 126
             data-l10n-id="config-context-menu-copy-pref-value"
    
    143
    -        _onclick_="AboutConfig.clipboardCopy('value')"
    
    144 127
           ></menuitem>
    
    145 128
         </menu>
    
    146 129
       </body>
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx