From 989cbc1b80fb2cd5e15994c2d8ffa92f81985684 Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Sun, 4 Sep 2016 21:07:33 -0500 Subject: [PATCH] Fix Chrome tests with strict null checking enabled Enabled strict null checking for Chrome tests and fixed some issues with the existing tests. The example code at https://developer.chrome.com/extensions/examples/api/bookmarks/basic/popup.js would use an uninitialized 'span' variable if bookmarkNode.title was empty. Since I have no idea what it was supposed to do in that case, I just moved the declaration of span up a block. --- chrome/chrome-tests.ts | 8 ++++---- chrome/tsconfig.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/chrome-tests.ts b/chrome/chrome-tests.ts index e7efd0b604..7788397a4c 100644 --- a/chrome/chrome-tests.ts +++ b/chrome/chrome-tests.ts @@ -26,6 +26,7 @@ function bookmarksExample() { return list; } function dumpNode(bookmarkNode, query) { + var span = $(''); if (bookmarkNode.title) { if (query && !bookmarkNode.children) { if (String(bookmarkNode.title).indexOf(query) == -1) { @@ -42,7 +43,6 @@ function bookmarksExample() { anchor.click(function () { chrome.tabs.create({ url: bookmarkNode.url }); }); - var span = $(''); var options = bookmarkNode.children ? $('[Add]') : $('[Edit { + chrome.proxy.settings.get({ incognito: true }, (details) => { var val = details.value; var level: string = details.levelOfControl; - var incognito: boolean = details.incognitoSpecific; + var incognito: boolean = details.incognitoSpecific!; }); // bare minimum set call diff --git a/chrome/tsconfig.json b/chrome/tsconfig.json index f40142d6ae..120b5d78dc 100644 --- a/chrome/tsconfig.json +++ b/chrome/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../"