diff --git a/src/core/catalog.js b/src/core/catalog.js index 8611eab9b5e570..15d225bc92a6dd 100644 --- a/src/core/catalog.js +++ b/src/core/catalog.js @@ -25,7 +25,6 @@ import { DocumentActionEventType, FormatError, info, - isBool, isString, objectSize, PermissionFlag, @@ -221,7 +220,7 @@ class Catalog { continue; } const value = obj.get(key); - if (!isBool(value)) { + if (typeof value !== "boolean") { continue; } markInfo[key] = value; @@ -1521,7 +1520,7 @@ class Catalog { } // The 'NewWindow' property, equal to `LinkTarget.BLANK`. const newWindow = action.get("NewWindow"); - if (isBool(newWindow)) { + if (typeof newWindow === "boolean") { resultObj.newWindow = newWindow; } break; diff --git a/src/core/function.js b/src/core/function.js index d402d067bd534e..37710610f8be40 100644 --- a/src/core/function.js +++ b/src/core/function.js @@ -17,7 +17,6 @@ import { Dict, Ref } from "./primitives.js"; import { FormatError, info, - isBool, IsEvalSupportedCached, shadow, unreachable, @@ -627,7 +626,7 @@ class PostScriptEvaluator { case "and": b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if (typeof a === "boolean" && typeof b === "boolean") { stack.push(a && b); } else { stack.push(a & b); @@ -751,7 +750,7 @@ class PostScriptEvaluator { break; case "not": a = stack.pop(); - if (isBool(a)) { + if (typeof a === "boolean") { stack.push(!a); } else { stack.push(~a); @@ -760,7 +759,7 @@ class PostScriptEvaluator { case "or": b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if (typeof a === "boolean" && typeof b === "boolean") { stack.push(a || b); } else { stack.push(a | b); @@ -802,7 +801,7 @@ class PostScriptEvaluator { case "xor": b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if (typeof a === "boolean" && typeof b === "boolean") { stack.push(a !== b); } else { stack.push(a ^ b); diff --git a/src/shared/util.js b/src/shared/util.js index 4e84ea58dc4270..de0a2e5c5bb9a9 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -1030,10 +1030,6 @@ function utf8StringToString(str) { return unescape(encodeURIComponent(str)); } -function isBool(v) { - return typeof v === "boolean"; -} - function isString(v) { return typeof v === "string"; } @@ -1139,7 +1135,6 @@ export { isArrayBuffer, isArrayEqual, isAscii, - isBool, IsEvalSupportedCached, IsLittleEndianCached, isSameOrigin, diff --git a/test/unit/util_spec.js b/test/unit/util_spec.js index 8f70e7054f8b04..506cc8480858f1 100644 --- a/test/unit/util_spec.js +++ b/test/unit/util_spec.js @@ -21,7 +21,6 @@ import { getModificationDate, isArrayBuffer, isAscii, - isBool, isSameOrigin, isString, string32, @@ -74,22 +73,6 @@ describe("util", function () { }); }); - describe("isBool", function () { - it("handles boolean values", function () { - expect(isBool(true)).toEqual(true); - expect(isBool(false)).toEqual(true); - }); - - it("handles non-boolean values", function () { - expect(isBool("true")).toEqual(false); - expect(isBool("false")).toEqual(false); - expect(isBool(1)).toEqual(false); - expect(isBool(0)).toEqual(false); - expect(isBool(null)).toEqual(false); - expect(isBool(undefined)).toEqual(false); - }); - }); - describe("isString", function () { it("handles string values", function () { expect(isString("foo")).toEqual(true);