Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: remove checks for IE and EdgeHTML in core #6336

Merged
merged 7 commits into from
Aug 17, 2022

Conversation

rachel-fenichel
Copy link
Collaborator

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Part of #6325

Proposed Changes

  • Remove uses of userAgent.IE
  • Remove export of userAgent.IE

Breaking change because of the removed export.

Behavior Before Change

Assorted checks for IE in our code.

Behavior After Change

No special behaviour for IE--but note that there are still special cases for Edge.

Reason for Changes

No more IE support.

Test Coverage

Built and ran tests.

Additional Information

isGecko still uses whether IE has been found inside useragent.js

isGecko = has('Gecko') && !isWebKit && !isIe && !isEdge;

We should consider removing all exports from useragent.js that we aren't already using. User agent sniffing is highly not-recommended, and we can get rid of excess exports. It's technically a breaking change, but I think we want to do it in this release.

@rachel-fenichel rachel-fenichel requested a review from a team as a code owner August 11, 2022 18:57
@rachel-fenichel rachel-fenichel added component: browser breaking change Used to mark a PR or issue that changes our public APIs. PR: chore General chores (dependencies, typos, etc) labels Aug 11, 2022
Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also investigate whether the Edge special cases are still needed - since Edge is now based on Chromium as of 2020 I would expect it to not. but that can be follow up work.

core/field.ts Outdated
@@ -797,7 +797,7 @@ export abstract class Field implements IASTNodeLocationSvg,
scaledWidth += 1 * scale;
scaledHeight += 1 * scale;
} else {
if (!userAgent.EDGE && !userAgent.IE) {
if (!userAgent.EDGE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to this PR but I don't understand how this set of if/else squares with the comments above it. If Gecko and Edge are in the same behavior group why are they handled differently here?

I also don't understand why the bounding box behavior from the browser comes into play - I don't see where that's called in the calculation of getHeightWidth but I didn't finish tracing the call all the way down the stack.

so no action needed but if you are familiar with this bit of code i would love to learn more about it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this more and concluded that we can remove the checks for Edge entirely, and that it makes sense to do so in the same PR since multiple of the checks are for both IE and Edge.

However, I need to load it in Firefox to check that it works after my changes, and I found that Firefox is broken.

@maribethb
Copy link
Contributor

Also, I don't think this should be a chore. We don't have a strict definition, but generally I think chores shouldn't affect source code. In particular I think chores are left out of the release notes by some tools, or chores should be things we are comfortable leaving out of the release notes as they wouldn't affect external users.

So I would probably call this a fix even though it's not really a bug fix, but it's the closest thing. Or our docs say we can use the "deprecate" tag even though I'm not sure anyone has, and it only sort of fits this scenario.

@rachel-fenichel rachel-fenichel changed the title chore!: remove checks for IE in core fix!: remove checks for IE and EdgeHTML in core Aug 12, 2022
core/field.ts Outdated
scaledWidth = bBox.width * scale;
scaledHeight = bBox.height * scale;
scaledWidth = (bBox.width + 1) * scale;
scaledHeight = (bBox.height +1) * scale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the line causing the clang error

// Useragent for JavaFX:
// Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44
// (KHTML, like Gecko) JavaFX/8.0 Safari/537.44
isJavaFx = has('JavaFX');
isChrome = (has('Chrome') || has('CriOS')) && !isEdge;
isChrome = (has('Chrome') || has('CriOS'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we use these for anything? maybe we should fully get rid of the ones we don't need at all

@maribethb maribethb added PR: fix Fixes a bug and removed PR: chore General chores (dependencies, typos, etc) labels Aug 15, 2022
@rachel-fenichel
Copy link
Collaborator Author

Updated to fix Firefox by returning to AnyDuringMigration (fixes #6340). Please take a look.

Fully removing all of the user agent types we don't use sounds good as a followup PR, and matches with the goal of getting API changes out of the way this quarter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: browser PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants