Skip to content

Show incompatible error for missing platform URLs#3419

Merged
kumar303 merged 2 commits intomozilla:masterfrom
kumar303:platform-install-bug-3266
Oct 10, 2017
Merged

Show incompatible error for missing platform URLs#3419
kumar303 merged 2 commits intomozilla:masterfrom
kumar303:platform-install-bug-3266

Conversation

@kumar303
Copy link
Contributor

@kumar303 kumar303 commented Oct 9, 2017

Fixes mozilla/addons#10829

Previously when an add-on declared itself compatible with a platform yet was missing a platform file, we just let the user try to install it. This resulted in a console error because there was no install URL. This patch shows an incompatible error banner and disables the install button instead.

@kumar303 kumar303 force-pushed the platform-install-bug-3266 branch from 325509f to fa8010b Compare October 9, 2017 20:57
@codecov-io
Copy link

codecov-io commented Oct 9, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    mozilla/addons-frontend#3419      +/-   ##
==========================================
+ Coverage   95.72%   95.72%   +<.01%     
==========================================
  Files         175      175              
  Lines        3366     3371       +5     
  Branches      672      674       +2     
==========================================
+ Hits         3222     3227       +5     
  Misses        124      124              
  Partials       20       20
Impacted Files Coverage Δ
src/core/utils.js 100% <100%> (ø) ⬆️
...rc/amo/components/AddonCompatibilityError/index.js 100% <100%> (ø) ⬆️
src/core/constants.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 f83e98d...feac839. Read the comment docs.

@kumar303 kumar303 requested a review from tofumatt October 9, 2017 20:58
Copy link
Contributor

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

r+wc, I'm not sure about the theme test and I think you could use the existing dispatchClientMetadata helper. Looks good otherwise, thanks!

return { compatible: false, reason: INCOMPATIBLE_NO_OPENSEARCH };
}

// Even if an extension's version is marked compatible,
Copy link
Contributor

Choose a reason for hiding this comment

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

These are the edge cases that make AMO so special 😆

let store;

beforeEach(() => {
store = createStore().store;
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use dispatchClientMetadata for a more accurate/complete "default" store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component relies on lang and userAgent so I wanted each test to call dispatchClientMetadata() instead since the values are important. I can add a comment to this if it's helpful though.

lang: 'en-GB',
reason: INCOMPATIBLE_NOT_FIREFOX,
userAgentInfo: { browser: { name: 'Chrome' }, os: {} },
_dispatchClientMetadata({
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why this was made when we could use the existing dispatchClientMetadata helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this helper I don't have to pass store into the function every time

});
});

it('allows non-extensions to have mismatching platform files', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this ever happen? I didn't think themes could/did set platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure but since this code is only working around a bug in extensions I wanted to limit it there until we know we need it elsewhere.

@kumar303 kumar303 merged commit c64c9a2 into mozilla:master Oct 10, 2017
@kumar303 kumar303 deleted the platform-install-bug-3266 branch October 10, 2017 14:26
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.

Add-ons incompatible with your platform look installable

3 participants