Skip to content

amp-bind: Remove web-worker fallback code#8956

Merged
dreamofabear merged 7 commits intoampproject:masterfrom
dreamofabear:clean-web-worker-exp
May 11, 2017
Merged

amp-bind: Remove web-worker fallback code#8956
dreamofabear merged 7 commits intoampproject:masterfrom
dreamofabear:clean-web-worker-exp

Conversation

@dreamofabear
Copy link
Copy Markdown

@dreamofabear dreamofabear commented Apr 26, 2017

Fixes #8955.

@dreamofabear dreamofabear force-pushed the clean-web-worker-exp branch 4 times, most recently from 1b77eff to 8b81c88 Compare April 27, 2017 20:21
@dreamofabear dreamofabear force-pushed the clean-web-worker-exp branch from 0ed6187 to 031990d Compare May 8, 2017 17:36
@dreamofabear dreamofabear force-pushed the clean-web-worker-exp branch from 16c46cd to 7d1a3e0 Compare May 8, 2017 22:06
stub.returns('stubbed');
evaluator.evaluateBindings({});
expect(stub.calledOnce).to.be.true;
});
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was moved from test-bind-impl.js.

@dreamofabear
Copy link
Copy Markdown
Author

/to @kmh287

Copy link
Copy Markdown
Contributor

@kmh287 kmh287 left a comment

Choose a reason for hiding this comment

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

LGTM, sorry I missed this

// Experiment check is bypassed on test mode -- make sure it isn't.
window.AMP_MODE = {test: false};
env.sandbox.stub(getMode(), 'test', false);
expect(() => {
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.

Is this the preferred way to stub the mode?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Setting window.AMP_MODE is more common but stubbing avoids overwriting other mode properties (e.g. line 180).

IMO stubbing is generally better practice than setting global vars, but maybe there's something I'm missing. /cc @jridgewell

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.

Use AMP_MODE, we exported it specifically for this. You can use Object.assign if you're worried about conflicting properties.

Copy link
Copy Markdown
Author

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

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

You didn't miss it, it was "WIP" for awhile. :)

// Experiment check is bypassed on test mode -- make sure it isn't.
window.AMP_MODE = {test: false};
env.sandbox.stub(getMode(), 'test', false);
expect(() => {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Setting window.AMP_MODE is more common but stubbing avoids overwriting other mode properties (e.g. line 180).

IMO stubbing is generally better practice than setting global vars, but maybe there's something I'm missing. /cc @jridgewell

@dreamofabear dreamofabear force-pushed the clean-web-worker-exp branch from fd2bc6d to 5502c86 Compare May 11, 2017 03:53
@dreamofabear dreamofabear force-pushed the clean-web-worker-exp branch from 5502c86 to 44ce829 Compare May 11, 2017 04:00
@dreamofabear dreamofabear merged commit 60631a2 into ampproject:master May 11, 2017
@dreamofabear dreamofabear deleted the clean-web-worker-exp branch May 11, 2017 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants