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.
This commit is contained in:
Joel Spadin
2016-09-04 21:07:33 -05:00
parent 29fb8c50c7
commit 989cbc1b80
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -26,6 +26,7 @@ function bookmarksExample() {
return list;
}
function dumpNode(bookmarkNode, query) {
var span = $('<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 = $('<span>');
var options = bookmarkNode.children ?
$('<span>[<a href="#" id="addlink">Add</a>]</span>') :
$('<span>[<a id="editlink" href="#">Edit</a> <a id="deletelink" ' +
@@ -146,7 +146,7 @@ function pageRedder() {
function printPage() {
chrome.browserAction.onClicked.addListener(function (tab) {
var action_url = "javascript:window.print();";
chrome.tabs.update(tab.id, { url: action_url });
chrome.tabs.update(tab.id!, { url: action_url });
});
}
@@ -173,10 +173,10 @@ function catBlock () {
// contrived settings example
function proxySettings() {
chrome.proxy.settings.get({ incognito: false }, (details) => {
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
+1 -1
View File
@@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"