Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Remove obvious special cases for IE10 and below.
Browse files Browse the repository at this point in the history
RELNOTES: Drop support for IE10

PiperOrigin-RevId: 484648225
Change-Id: Ia035e0be683b0c2e4028c46d821826c720e80dfa
  • Loading branch information
concavelenz authored and copybara-github committed Oct 28, 2022
1 parent 9979d6c commit b15ae93
Show file tree
Hide file tree
Showing 62 changed files with 407 additions and 1,149 deletions.
3 changes: 0 additions & 3 deletions closure/goog/crypt/base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,6 @@ goog.crypt.base64.decodeStringToByteArray = function(input, opt_ignored) {
*/
goog.crypt.base64.decodeStringToUint8Array = function(input) {
'use strict';
goog.asserts.assert(
!goog.userAgent.IE || goog.userAgent.isVersionOrHigher('10'),
'Browser does not support typed arrays');
var len = input.length;
// Approximate the length of the array needed for output.
// Our method varies according to the format of the input, which we can
Expand Down
18 changes: 7 additions & 11 deletions closure/goog/crypt/sha2_64bit_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const Sha512_256 = goog.require('goog.crypt.Sha512_256');
const crypt = goog.require('goog.crypt');
const hashTester = goog.require('goog.crypt.hashTester');
const testSuite = goog.require('goog.testing.testSuite');
const userAgent = goog.require('goog.userAgent');

/**
* Each object in the test vector array is a source text and one or more
Expand Down Expand Up @@ -163,16 +162,13 @@ testSuite({

/** Test one really large string using SHA512 */
testHashing512Large() {
// This test tends to time out on IE7 and IE8. See b/22873770.
if (!userAgent.IE || userAgent.isVersionOrHigher('9')) {
const hasher = new Sha512();
hasher.update((new Array(1000000)).fill(0));
const digest = hasher.digest();
const expected = crypt.hexToByteArray(
'ce044bc9fd43269d5bbc946cbebc3bb711341115cc4abdf2edbc3ff2c57ad4b1' +
'5deb699bda257fea5aef9c6e55fcf4cf9dc25a8c3ce25f2efe90908379bff7ed');
assertElementsEquals(expected, digest);
}
const hasher = new Sha512();
hasher.update((new Array(1000000)).fill(0));
const digest = hasher.digest();
const expected = crypt.hexToByteArray(
'ce044bc9fd43269d5bbc946cbebc3bb711341115cc4abdf2edbc3ff2c57ad4b1' +
'5deb699bda257fea5aef9c6e55fcf4cf9dc25a8c3ce25f2efe90908379bff7ed');
assertElementsEquals(expected, digest);
},

/** Check that the code throws an error for bad input */
Expand Down
2 changes: 0 additions & 2 deletions closure/goog/debug/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ closure_js_library(
"//closure/goog/disposable",
"//closure/goog/events",
"//closure/goog/events:event",
"//closure/goog/events:eventtarget",
"//closure/goog/log",
"//closure/goog/net:xhrio",
"//closure/goog/object",
"//closure/goog/uri:utils",
"//closure/goog/useragent",
],
)

Expand Down
48 changes: 17 additions & 31 deletions closure/goog/debug/error_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,26 @@ testSuite({

assertEquals('Message property should be set', 'testing', message);

expectedFailures.expectFailureFor(
(userAgent.IE && !userAgent.isVersionOrHigher('10')) ||
product.SAFARI ||
(product.CHROME && !userAgent.isVersionOrHigher(532)),
'error.stack is not widely supported');
assertNotNull(stack);

try {
assertNotNull(stack);

if (product.FIREFOX) {
// Firefox 4 and greater does not have the first line that says
// 'Error'. So we insert a dummy line to simplify the test.
stack.splice(0, 0, 'Error');
}

// If the stack trace came from a synthetic Error object created
// inside the goog.debug.Error constructor, it will have an extra frame
// at stack[1]. If it came from captureStackTrace or was attached
// by IE when the error was caught, it will not.
if (!Error.captureStackTrace && !userAgent.IE) {
stack.splice(1, 1); // Remove stack[1].
}
if (product.FIREFOX) {
// Firefox 4 and greater does not have the first line that says
// 'Error'. So we insert a dummy line to simplify the test.
stack.splice(0, 0, 'Error');
}

assertContains(
'1st line of stack should have "Error"', 'Error', stack[0]);
assertContains(
'2nd line of stack should have "zzzzz"', 'zzzzz', stack[1]);
assertContains(
'3rd line of stack should have "yyyyy"', 'yyyyy', stack[2]);
assertContains(
'4th line of stack should have "xxxxx"', 'xxxxx', stack[3]);
} catch (e) {
expectedFailures.handleException(e);
// If the stack trace came from a synthetic Error object created
// inside the goog.debug.Error constructor, it will have an extra frame
// at stack[1]. If it came from captureStackTrace or was attached
// by IE when the error was caught, it will not.
if (!Error.captureStackTrace && !userAgent.IE) {
stack.splice(1, 1); // Remove stack[1].
}

assertContains('1st line of stack should have "Error"', 'Error', stack[0]);
assertContains('2nd line of stack should have "zzzzz"', 'zzzzz', stack[1]);
assertContains('3rd line of stack should have "yyyyy"', 'yyyyy', stack[2]);
assertContains('4th line of stack should have "xxxxx"', 'xxxxx', stack[3]);
},

/** @suppress {checkTypes} suppression added to enable type checking */
Expand Down
24 changes: 8 additions & 16 deletions closure/goog/debug/errorreporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ goog.require('goog.log');
goog.require('goog.net.XhrIo');
goog.require('goog.object');
goog.require('goog.uri.utils');
goog.require('goog.userAgent');



Expand Down Expand Up @@ -264,21 +263,14 @@ if (goog.debug.ErrorReporter.ALLOW_AUTO_PROTECT) {
*/
goog.debug.ErrorReporter.prototype.setup_ = function() {
'use strict';
if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('10')) {
// Use "onerror" because caught exceptions in IE don't provide line
// number.
goog.debug.catchErrors(
goog.bind(this.handleException, this), false, null);
} else {
// "onerror" doesn't work with FF2 or Chrome
this.errorHandler_ =
new goog.debug.ErrorHandler(goog.bind(this.handleException, this));

this.errorHandler_.protectWindowSetTimeout();
this.errorHandler_.protectWindowSetInterval();
this.errorHandler_.protectWindowRequestAnimationFrame();
goog.debug.entryPointRegistry.monitorAll(this.errorHandler_);
}
// "onerror" doesn't work with FF2 or Chrome
this.errorHandler_ =
new goog.debug.ErrorHandler(goog.bind(this.handleException, this));

this.errorHandler_.protectWindowSetTimeout();
this.errorHandler_.protectWindowSetInterval();
this.errorHandler_.protectWindowRequestAnimationFrame();
goog.debug.entryPointRegistry.monitorAll(this.errorHandler_);
};
}

Expand Down
32 changes: 2 additions & 30 deletions closure/goog/debug/errorreporter_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,7 @@ testSuite({
assertEquals('trace=Not%20available', MockXhrIo.lastContent);
},

/** @suppress {checkTypes} suppression added to enable type checking */
test_internetExplorerSendErrorReport() {
stubs.set(userAgent, 'IE', true);
stubs.set(userAgent, 'isVersionOrHigher', functions.FALSE);

// Remove test runner's onerror handler so the test doesn't fail.
stubs.set(globalThis, 'onerror', null);

errorReporter = ErrorReporter.install('/errorreporter');
globalThis.onerror('Goodbye :(', url, 22);
assertEquals(
`/errorreporter?script=${encodedUrl}` +
'&error=Goodbye%20%3A(&line=22',
MockXhrIo.lastUrl);
assertEquals('trace=Not%20available', MockXhrIo.lastContent);
},

/** @suppress {checkTypes} suppression added to enable type checking */
test_setLoggingHeaders() {
stubs.set(userAgent, 'IE', true);
stubs.set(userAgent, 'isVersionOrHigher', functions.FALSE);
// Remove test runner's onerror handler so the test doesn't fail.
stubs.set(globalThis, 'onerror', null);

errorReporter = ErrorReporter.install('/errorreporter');
errorReporter.setLoggingHeaders('header!');
globalThis.onerror('Goodbye :(', 'http://www.your.tst/more/bogus.js', 22);
assertEquals('header!', MockXhrIo.lastHeaders);
},

test_nonInternetExplorerSendErrorReportWithTrace() {
stubs.set(userAgent, 'IE', false);
Expand Down Expand Up @@ -341,12 +313,12 @@ testSuite({

testProtectAdditionalEntryPoint_IE() {
stubs.set(userAgent, 'IE', true);
stubs.set(userAgent, 'isVersionOrHigher', functions.FALSE);

errorReporter = ErrorReporter.install('/errorreporter');
const fn = () => {};
const protectedFn = errorReporter.protectAdditionalEntryPoint(fn);
assertNull(protectedFn);
assertNotNull(protectedFn);
assertNotEquals(fn, protectedFn);
},

testHandleException_dispatchesEvent() {
Expand Down
Loading

0 comments on commit b15ae93

Please sign in to comment.