-
Notifications
You must be signed in to change notification settings - Fork 4k
Add preferred alternatives to problematic terminology #40348
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
Open
StarbirdTech
wants to merge
6
commits into
ampproject:main
Choose a base branch
from
StarbirdTech:fix-terminology-issue-30789
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
73fa567
Add preferred alternatives to problematic terminology, closes #30789
StarbirdTech a198e0c
Add test coverage for terminology alias functions
StarbirdTech 1abab23
clean up tests
StarbirdTech 326bd70
fix formatting
StarbirdTech d5dce51
update documentation
StarbirdTech c456534
Apply suggestions from code review
StarbirdTech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,9 +279,13 @@ documentation with the new behaviors on user's consent choices. You can refer to | |
|
||
#### JS reuse across iframes | ||
|
||
To allow ads to bundle HTTP requests across multiple ad units on the same page the object `window.context.master` will contain the window object of the iframe being elected master iframe for the current page. The `window.context.isMaster` property is `true` when the current frame is the master frame. | ||
To allow ads to bundle HTTP requests across multiple ad units on the same page, use `window.context.coordinator` to access the coordinating iframe window object, and `window.context.isCoordinator` to check if the current frame is the coordinating frame. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @powerivq do you know if 3rd party code would need to make changes for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They will. The best we can do is to offer an alias therefore. |
||
|
||
The `computeInMasterFrame` function is designed to make it easy to perform a task only in the master frame and provide the result to all frames. It is also available to custom ad iframes as `window.context.computeInMasterFrame`. See [3p.js](https://github.com/ampproject/amphtml/blob/main/3p/3p.js) for function signature. | ||
_Note: The legacy properties `window.context.master` and `window.context.isMaster` are still available for backward compatibility._ | ||
|
||
The `computeInCoordinatingFrame` function is designed to make it easy to perform a task only in the coordinating frame and provide the result to all frames. It is available to custom ad iframes as `window.context.computeInCoordinatingFrame`. See [3p.js](https://github.com/ampproject/amphtml/blob/main/3p/3p.js) for the function signature. | ||
|
||
_Note: The legacy function `window.context.computeInMasterFrame` is still available for backward compatibility._ | ||
|
||
#### Preconnect and prefetch | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,61 @@ | ||
import {masterSelection} from '#3p/ampcontext-integration'; | ||
import { | ||
IntegrationAmpContext, | ||
masterSelection, | ||
} from '#3p/ampcontext-integration'; | ||
|
||
describes.fakeWin('#masterSelect', {}, (env) => { | ||
it('should allow sharing between configured networks', () => | ||
expect(masterSelection(env.win, 'fake_network').name).to.equal( | ||
'frame_fake_network_master' | ||
)); | ||
}); | ||
|
||
describes.sandboxed('IntegrationAmpContext aliases', {}, (env) => { | ||
let context; | ||
|
||
beforeEach(() => { | ||
context = Object.create(IntegrationAmpContext.prototype); | ||
context.master_ = env.sandbox.stub().returns('test-master-window'); | ||
context.isMaster_ = env.sandbox.stub().returns(true); | ||
context.computeInMasterFrame = env.sandbox.stub(); | ||
}); | ||
StarbirdTech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
it('should delegate coordinator to master', () => { | ||
const result = context.coordinator; | ||
|
||
expect(context.master_).to.have.been.calledOnce; | ||
expect(result).to.equal('test-master-window'); | ||
}); | ||
|
||
it('should delegate isCoordinator to isMaster', () => { | ||
const result = context.isCoordinator; | ||
|
||
expect(context.isMaster_).to.have.been.calledOnce; | ||
expect(result).to.equal(true); | ||
}); | ||
|
||
it('should execute computeInCoordinatingFrame method', () => { | ||
const masterWindow = {__ampMasterTasks: {}}; | ||
const global = { | ||
context: { | ||
master: masterWindow, | ||
isMaster: true, | ||
}, | ||
}; | ||
const taskId = 'test-task'; | ||
let workCalled = false; | ||
const work = (done) => { | ||
workCalled = true; | ||
done('result'); | ||
}; | ||
let callbackResult; | ||
const cb = (result) => { | ||
callbackResult = result; | ||
}; | ||
|
||
context.computeInCoordinatingFrame(global, taskId, work, cb); | ||
|
||
expect(workCalled).to.be.true; | ||
expect(callbackResult).to.equal('result'); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.