Bug 1553413 - Update and harden form data filtering for privacy to account for no data being passed in. r=dao a=jcristau
authorMike de Boer <mdeboer@mozilla.com>
Wed, 22 May 2019 09:46:58 +0000
changeset 533472 33995296c30b7941b2cc285ef6885f99cfb46367
parent 533471 f06d92271479ef53a162ce72f3ea95f7bdc7caa4
child 533473 5e00311d1ebd2d823a7491cba2782c18117be7c9
push id11331
push usernerli@mozilla.com
push dateWed, 29 May 2019 14:58:24 +0000
treeherdermozilla-beta@104b25c67fb0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, jcristau
bugs1553413
milestone68.0
Bug 1553413 - Update and harden form data filtering for privacy to account for no data being passed in. r=dao a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D32116
toolkit/modules/sessionstore/PrivacyFilter.jsm
--- a/toolkit/modules/sessionstore/PrivacyFilter.jsm
+++ b/toolkit/modules/sessionstore/PrivacyFilter.jsm
@@ -41,17 +41,17 @@ var PrivacyFilter = Object.freeze({
    *
    * @param data The form data as collected from a tab.
    * @return object
    */
   filterFormData(data) {
     // If the given form data object has an associated URL that we are not
     // allowed to store data for, bail out. We explicitly discard data for any
     // children as well even if storing data for those frames would be allowed.
-    if (data.url && !PrivacyLevel.check(data.url)) {
+    if (!data || (data.url && !PrivacyLevel.check(data.url))) {
       return null;
     }
 
     let retval = {};
 
     for (let key of Object.keys(data)) {
       if (key === "children") {
         let recurse = child => this.filterFormData(child);