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: fatal error when current JS is not inside script tag #2229

Closed
wants to merge 1 commit into from

Conversation

misak113
Copy link

@misak113 misak113 commented Aug 27, 2019

  • for example when html-webpack-inline-source-plugin is used, the JS is inlined in HTML in script tag. So in this case document.currentScript.getAttribute('src') is undefined
  • undefined cannot be used as string with method replace. This cause a fatal error and crash app
  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

Motivation / Use-Case

Breaking Changes

Additional Info

* for example when html-webpack-inline-source-plugin is used, the JS is inlined in HTML in script tag. So in this case document.currentScript.getAttribute('src') is undefined
* undefined cannot be used as string with method replace. This cause a fatal error and crash app
@jsf-clabot
Copy link

jsf-clabot commented Aug 27, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Need tests

@misak113
Copy link
Author

Hi, I'm sorry for failing PR, but I added a special case to tests, where getCurrentScriptSource returns undefined. So it could be enough for test coverage. It's exactly the value, which would have been failing tests when my change is not applied.
b488304#diff-2ee53e81db4e6170cf44cc607e849f1aR17

@alexander-akait
Copy link
Member

alexander-akait commented Aug 27, 2019

We need fix CI error

@knagaitsev knagaitsev closed this Sep 12, 2019
@knagaitsev knagaitsev reopened this Sep 12, 2019
@codecov
Copy link

codecov bot commented Sep 12, 2019

Codecov Report

Merging #2229 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2229      +/-   ##
=========================================
+ Coverage   93.89%   93.9%   +<.01%     
=========================================
  Files          34      34              
  Lines        1278    1279       +1     
  Branches      366     367       +1     
=========================================
+ Hits         1200    1201       +1     
  Misses         71      71              
  Partials        7       7
Impacted Files Coverage Δ
client-src/default/utils/createSocketUrl.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 056a212...b488304. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Sep 12, 2019

Codecov Report

Merging #2229 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2229      +/-   ##
=========================================
+ Coverage   93.89%   93.9%   +<.01%     
=========================================
  Files          34      34              
  Lines        1278    1279       +1     
  Branches      366     367       +1     
=========================================
+ Hits         1200    1201       +1     
  Misses         71      71              
  Partials        7       7
Impacted Files Coverage Δ
client-src/default/utils/createSocketUrl.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 056a212...b488304. Read the comment docs.

@knagaitsev knagaitsev mentioned this pull request Sep 12, 2019
6 tasks
@knagaitsev
Copy link
Collaborator

Closing in favor of #2246

@knagaitsev knagaitsev closed this Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants