Skip to content

Commit

Permalink
Update trust levels for existing actions to spec (#9954)
Browse files Browse the repository at this point in the history
* update trusts to spec for existing actions/events

* update docs
  • Loading branch information
William Chou authored Jun 16, 2017
1 parent 7830be0 commit 07977bd
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 41 deletions.
2 changes: 1 addition & 1 deletion extensions/amp-carousel/0.1/slidescroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class AmpSlideScroll extends BaseSlides {
if (args) {
this.showSlideWhenReady(args['index']);
}
}, ActionTrust.MEDIUM); // TODO(choumx, #9699): LOW.
}, ActionTrust.LOW);
}

/** @override */
Expand Down
5 changes: 2 additions & 3 deletions extensions/amp-form/0.1/amp-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ export class AmpForm {
this.verifier_ = getFormVerifier(
this.form_, () => this.handleXhrVerify_());

// TODO(choumx, #9699): HIGH.
this.actions_.installActionHandler(
this.form_, this.actionHandler_.bind(this), ActionTrust.MEDIUM);
this.form_, this.actionHandler_.bind(this), ActionTrust.HIGH);
this.installEventHandlers_();

/** @private {?Promise} */
Expand Down Expand Up @@ -351,7 +350,7 @@ export class AmpForm {
event.preventDefault();
}
// Submits caused by user input have high trust.
this.submit_(ActionTrust.MEDIUM); // TODO(choumx, #9699): HIGH.
this.submit_(ActionTrust.HIGH);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions extensions/amp-live-list/0.1/amp-live-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ export class AmpLiveList extends AMP.BaseElement {
this.curNumOfLiveItems_ = this.validateLiveListItems_(
this.itemsSlot_, true);

// TODO(choumx, #9699): LOW.
this.registerAction(
'update', this.updateAction_.bind(this), ActionTrust.MEDIUM);
'update', this.updateAction_.bind(this), ActionTrust.LOW);

if (!this.element.hasAttribute('aria-live')) {
this.element.setAttribute('aria-live', 'polite');
Expand Down
3 changes: 1 addition & 2 deletions extensions/amp-selector/0.1/amp-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,8 @@ export class AmpSelector extends AMP.BaseElement {
targetOption: el.getAttribute('option'),
selectedOptions: selectedValues,
});
// TODO(choumx, #9699): HIGH.
this.action_.trigger(this.element, name, selectEvent,
ActionTrust.MEDIUM);
ActionTrust.HIGH);
}
});
}
Expand Down
Loading

0 comments on commit 07977bd

Please sign in to comment.