Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Do not set source.isWasm attribute for old Firefox.#3412

Merged
jasonLaster merged 1 commit into
firefox-devtools:nextfrom
yurydelendik:old-iswasm
Jul 27, 2017
Merged

Do not set source.isWasm attribute for old Firefox.#3412
jasonLaster merged 1 commit into
firefox-devtools:nextfrom
yurydelendik:old-iswasm

Conversation

@yurydelendik

Copy link
Copy Markdown
Contributor

Associated Issue: https://devtools-html.slack.com/archives/C3VTWQ4KZ/p1500478468288028

Old Firefox browsers cannot return binary source. So we need to disable source.isWasm for these.

Summary of Changes

  • disable source.isWasm for browsers that does not support binary source

Test Plan

Observe no console errors about getSourceLineCount

@codecov

codecov Bot commented Jul 21, 2017

Copy link
Copy Markdown

Codecov Report

Merging #3412 into next will increase coverage by 0.07%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #3412      +/-   ##
==========================================
+ Coverage   51.39%   51.46%   +0.07%     
==========================================
  Files         109      109              
  Lines        4530     4531       +1     
  Branches      937      938       +1     
==========================================
+ Hits         2328     2332       +4     
+ Misses       2202     2199       -3
Impacted Files Coverage Δ
src/utils/editor/source-documents.js 6.25% <ø> (+0.25%) ⬆️
src/client/firefox/commands.js 15.78% <100%> (+0.74%) ⬆️
src/client/firefox/create.js 18.75% <100%> (+5.41%) ⬆️
src/client/firefox.js 88.23% <100%> (ø) ⬆️
src/client/firefox/events.js 39.13% <50%> (+2.76%) ⬆️
src/actions/ast.js 78.57% <0%> (+1.78%) ⬆️

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 a3cff60...e747be2. Read the comment docs.

@jasonLaster jasonLaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

one comment, otherwise good.

Comment thread src/client/firefox/commands.js Outdated
async function fetchSources() {
const { sources } = await threadClient.getSources();
return sources.map(createSource);
return sources.map(source => createSource(source, debuggerClient));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

perhaps a slightly different signature.

const supportsWasm = !!debuggerClient.mainRoot.traits.wasmBinarySource;
createSource(source, { supportsWasm }))

The rationale is that when devtools moves to github it will be easier to add a supportsWasm function in debuggerClient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added DebuggerClientTraits type to be used at multiple createSource callsites.

@yurydelendik yurydelendik changed the title Does not set source.isWasm attribute for old Firefox. Do not set source.isWasm attribute for old Firefox. Jul 21, 2017

@jasonLaster jasonLaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sorry for the back and forth, I'd prefer hiding debuggerClientTraits by keeping references to it in two spots, which we can later hide when we update debuggerClient

Comment thread src/client/firefox/create.js Outdated
export function createSource(source: SourcePayload): Source {
export function createSource(
source: SourcePayload,
debuggerClientTraits: DebuggerClientTraits

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer passing a smaller options object in: { supportsWasm: bool }. This will keep the interface smaller and more flexible

Comment thread src/client/firefox/commands.js Outdated
async function fetchSources() {
const { sources } = await threadClient.getSources();
return sources.map(createSource);
return sources.map(source => createSource(source, debuggerClientTraits));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small style knit

const supportsWasm = debuggerClient.debuggerClientTraits.supportsWasm
sources.map(source => createSource(source, { supportsWasm }));

Comment thread src/client/firefox/events.js Outdated

function newSource(_: "newSource", { source }: SourcePacket) {
actions.newSource(createSource(source));
actions.newSource(createSource(source, debuggerClientTraits));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const supportsWasm = debuggerClient.debuggerClientTraits.supportsWasm
actions.newSource(createSource(source, { supportsWasm });

if (!isEnabled("wasm")) {
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I cannot longer reproduce #3417, removing update line number formatting switch.

@jasonLaster jasonLaster merged commit 936db08 into firefox-devtools:next Jul 27, 2017
jasonLaster pushed a commit to jasonLaster/debugger.html that referenced this pull request Aug 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants