Skip to content

Commit

Permalink
Merge tag '1455681102244' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
camelburrito committed Feb 17, 2016
2 parents 94ba705 + 71bec5e commit 4727058
Show file tree
Hide file tree
Showing 85 changed files with 2,298 additions and 406 deletions.
3 changes: 2 additions & 1 deletion 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {manageWin} from './environment';
import {nonSensitiveDataPostMessage, listenParent} from './messaging';
import {twitter} from './twitter';
import {yieldmo} from '../ads/yieldmo';
import {register, run} from '../src/3p';
import {computeInMasterFrame, register, run} from '../src/3p';
import {parseUrl} from '../src/url';
import {assert} from '../src/asserts';
import {taboola} from '../ads/taboola';
Expand Down Expand Up @@ -156,6 +156,7 @@ window.draw3p = function(opt_configCallback) {
window.context.onResizeDenied = onResizeDenied;
window.context.reportRenderedEntityIdentifier =
reportRenderedEntityIdentifier;
window.context.computeInMasterFrame = computeInMasterFrame;
delete data._context;

manageWin(window);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ under the [Apache License, Version 2.0](LICENSE).

Please see [the CONTRIBUTING file](CONTRIBUTING.md) for information on contributing to the AMP Project, and [the DEVELOPING file](DEVELOPING.md) for documentation on the AMP library internals and [hints how to get started](DEVELOPING.md#starter-issues).

### [Code of conduct](CODE_OF_CONDUCT.md)
### [Code of conduct](CODE_OF_CONDUCT.md)
2 changes: 1 addition & 1 deletion ads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Here are some factors that affect how fast the resize will be executed:
#### 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.

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.
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/master/src/3p.js) for function signature.

#### Preconnect and prefetch
Add the JS URLs that an ad **always** fetches or always connects to (if you know the origin but not the path) to [_config.js](_config.js).
Expand Down
2 changes: 1 addition & 1 deletion ads/integration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ A brightcove player can be invoked by the following:
<amp-brightcove
data-account="906043040001"
data-video-id="1401169490001"
data-player-id="180a5658-8be8-4f33-8eba-d562ab41b40c"
data-player="180a5658-8be8-4f33-8eba-d562ab41b40c"
layout="responsive" width="480" height="270">
</amp-brightcove>
```
Expand Down
1 change: 0 additions & 1 deletion build-system/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ module.exports = {
'!validator/node_modules/**/*.*',
'!build-system/tasks/presubmit-checks.js',
'!build/polyfills.js',
'!build/polyfills/*.js',
'!gulpfile.js',
'!third_party/**/*.*',
],
Expand Down
33 changes: 9 additions & 24 deletions build-system/tasks/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var rename = require('gulp-rename');
var replace = require('gulp-replace');
var internalRuntimeVersion = require('../internal-version').VERSION;
var internalRuntimeToken = require('../internal-version').TOKEN;
var rimraf = require('rimraf');

var isProdBuild = !!argv.type;
var queue = [];
Expand Down Expand Up @@ -70,12 +69,14 @@ function compile(entryModuleFilename, outputDir,
entryModuleFilename.replace(/\//g, '_').replace(/^\./, '');
console./*OK*/log('Starting closure compiler for ', entryModuleFilename);
fs.mkdirsSync('build/cc');
rimraf.sync('build/fake-module');
fs.mkdirsSync('build/fake-module/third_party/babel');
fs.mkdirsSync('build/fake-module/src/polyfills/');
var unneededFiles = [
'build/fake-module/third_party/babel/custom-babel-helpers.js',
];
fs.mkdirsSync('build/fake-module/src');
fs.writeFileSync(
'build/fake-module/third_party/babel/custom-babel-helpers.js',
'// Not needed in closure compiler\n');
fs.writeFileSync(
'build/fake-module/src/polyfills.js',
'// Not needed in closure compiler\n');
var wrapper = windowConfig.getTemplate() +
'(function(){var process={env:{NODE_ENV:"production"}};' +
'%output%})();';
Expand Down Expand Up @@ -105,7 +106,6 @@ function compile(entryModuleFilename, outputDir,
'build/**/*.js',
'!build/cc/**',
'!build/polyfills.js',
'!build/polyfills/**/*.js',
'src/**/*.js',
'!third_party/babel/custom-babel-helpers.js',
// Exclude since it's not part of the runtime/extension binaries.
Expand All @@ -114,7 +114,6 @@ function compile(entryModuleFilename, outputDir,
'third_party/caja/html-sanitizer.js',
'third_party/closure-library/sha384-generated.js',
'third_party/mustache/**/*.js',
'node_modules/promise-pjs/promise.js',
'node_modules/document-register-element/build/' +
'document-register-element.max.js',
'node_modules/core-js/modules/**.js',
Expand All @@ -129,24 +128,10 @@ function compile(entryModuleFilename, outputDir,
// once. Since all files automatically wait for the main binary to load
// this works fine.
if (options.includePolyfills) {
srcs.push(
'!build/fake-module/src/polyfills.js',
'!build/fake-module/src/polyfills/**/*.js'
);
srcs.push('!build/fake-module/src/polyfills.js');
} else {
srcs.push(
'!src/polyfills.js',
'!src/polyfills/**/*.js'
);
unneededFiles.push(
'build/fake-module/src/polyfills.js',
'build/fake-module/src/polyfills/promise.js',
'build/fake-module/src/polyfills/math-sign.js'
);
srcs.push('!src/polyfills.js');
}
unneededFiles.forEach(function(fake) {
fs.writeFileSync(fake, '// Not needed in closure compiler\n');
});
/*eslint "google-camelcase/google-camelcase": 0*/
return gulp.src(srcs)
.pipe(closureCompiler({
Expand Down
2 changes: 2 additions & 0 deletions build-system/tasks/presubmit-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ var forbiddenTerms = {
'Array\\.of': es6polyfill,
// These currently depend on core-js/modules/web.dom.iterable which
// we don't want. That decision could be reconsidered.
'Promise\\.all': es6polyfill,
'Promise\\.race': es6polyfill,
'\\.startsWith': {
message: es6polyfill,
whitelist: [
Expand Down
55 changes: 54 additions & 1 deletion builtins/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,60 @@ limitations under the License.

AMP documents only support ads served via HTTPS.

#### Behavior
<table>
<tr>
<td width="40%"><strong>Description</strong></td>
<td>A container to display an ad.</td>
</tr>
<tr>
<td width="40%"><strong>Availability</strong></td>
<td>Stable</td>
</tr>
<tr>
<td width="40%"><strong>Examples</strong></td>
<td><a href="https://github.com/ampproject/amphtml/blob/master/examples/ads.amp.html">ads.amp.html</a></td>
</tr>
</table>

The following lists validation errors specific to the `amp-ad` tag
(see also `amp-ad` in the [AMP validator specification](https://github.com/ampproject/amphtml/blob/master/validator/validator.protoascii):

<table>
<tr>
<th width="40%"><strong>Validation Error</strong></th>
<th>Description</th>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#mandatory-attribute-missing">MANDATORY_ATTR_MISSING</a></td>
<td>Error thrown when <code>type</code> attribute missing.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#missing-url">MISSING_URL</a></td>
<td>Error thrown when <code>src</code> attribute is missing it's URL.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url">INVALID_URL</a></td>
<td>Error thrown when <code>src</code> attribute's URL is invalid.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url-protocol">INVALID_URL_PROTOCOL</a></td>
<td>Error thrown <code>src</code> attribute's URL is <code>http</code>; <code>https</code> protocol required.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#implied-layout-isnt-supported-by-amp-tag">IMPLIED_LAYOUT_INVALID</a></td>
<td>Error thrown when implied set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#specified-layout-isnt-supported-by-amp-tag">SPECIFIED_LAYOUT_INVALID</a></td>
<td>Error thrown when specified layout set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-property-value">INVALID_PROPERTY_VALUE_IN_ATTR_VALUE</a></td>
<td>Error thrown when invalid value is given for attributes <code>height</code> or <code>width</code>. For example, <code>height=auto</code> triggers this error for all supported layout types, with the exception of <code>NODISPLAY</code>.</td>
</tr>
</table>

### Behavior

The `<amp-ad>` requires width and height values to be specified like all
resources in AMP. It requires a `type` argument that select what ad network is displayed. All `data-*` attributes on the tag are automatically passed as arguments to the code that eventually renders the ad. What `data-` attributes are required for a given type of network depends and must be documented with the ad network.
Expand Down
53 changes: 52 additions & 1 deletion builtins/amp-img.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,58 @@ limitations under the License.

### <a name="amp-img"></a> `amp-img`

A runtime-managed replacement for the HTML `img` tag.
<table>
<tr>
<td width="40%"><strong>Description</strong></td>
<td>A runtime-managed replacement for the HTML <code>img</code> tag.</td>
</tr>
<tr>
<td width="40%"><strong>Availability</strong></td>
<td>Stable</td>
</tr>
<tr>
<td width="40%"><strong>Examples</strong></td>
<td><a href="https://github.com/ampproject/amphtml/blob/master/examples/responsive.amp.html">responsive.amp.html</a></td>
</tr>
</table>

The following lists validation errors specific to the `amp-img` tag
(see also `amp-img` in the [AMP validator specification](https://github.com/ampproject/amphtml/blob/master/validator/validator.protoascii):

<table>
<tr>
<th width="40%"><strong>Validation Error</strong></th>
<th>Description</th>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#mandatory-tag-ancestor-with-hint">MANDATORY_TAG_ANCESTOR_WITH_HINT</a></td>
<td>Error thrown if your AMP document uses <code>img</code> instead of <code>amp-img</code>. Error message: <code>The tag <code>img</code> may only appear as a descendant of tag <code>noscript</code>. Did you mean <code>amp-img</code>?</code>.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#mandatory-attribute-missing">MANDATORY_ONEOF_ATTR_MISSING</a></td>
<td>Error thrown when neither <code>src</code> or <code>srcset</code> is included. One of these attributes is mandatory.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#missing-url">MISSING_URL</a></td>
<td>Error thrown when <code>src</code> or <code>srcset</code> attribute is missing it's URL.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url">INVALID_URL</a></td>
<td>Error thrown when <code>src</code> or <code>srcset</code> attribute's URL is invalid.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#implied-layout-isnt-supported-by-amp-tag">IMPLIED_LAYOUT_INVALID</a></td>
<td>Error thrown when implied layout is set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#specified-layout-isnt-supported-by-amp-tag">SPECIFIED_LAYOUT_INVALID</a></td>
<td>Error thrown when specified layout is set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-property-value">INVALID_PROPERTY_VALUE_IN_ATTR_VALUE</a></td>
<td>Error thrown when invalid value is given for attributes <code>height</code> or <code>width</code>. For example, <code>height=auto</code> triggers this error for all supported layout types, with the exception of <code>NODISPLAY</code>.</td>
</tr>
</table>

#### Behavior

Expand Down
49 changes: 48 additions & 1 deletion builtins/amp-pixel.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,54 @@ limitations under the License.

### <a name="amp-pixel"></a> `amp-pixel`

The `amp-pixel` element is meant to be used as a typical tracking pixel - to count page views.
<table>
<tr>
<td width="40%"><strong>Description</strong></td>
<td>The <code>amp-pixel</code> element is meant to be used as a typical tracking pixel - to count page views.</td>
</tr>
<tr>
<td width="40%"><strong>Availability</strong></td>
<td>Stable</td>
</tr>
<tr>
<td width="40%"><strong>Examples</strong></td>
<td><a href="https://github.com/ampproject/amphtml/blob/master/examples/everything.amp.html">everything.amp.html</a></td>
</tr>
</table>

The following lists validation errors specific to the `amp-pixel` tag
(see also `amp-pixel` in the [AMP validator specification](https://github.com/ampproject/amphtml/blob/master/validator/validator.protoascii):

<table>
<tr>
<th width="40%"><strong>Validation Error</strong></th>
<th>Description</th>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#mandatory-attribute-missing">MANDATORY_ATTR_MISSING</a></td>
<td>Error thrown when <code>src</code> attribute is missing.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#missing-url">MISSING_URL</a></td>
<td>Error thrown when <code>src</code> attribute is missing it's URL.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url">INVALID_URL</a></td>
<td>Error thrown when <code>src</code> attribute's URL is invalid.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url-protocol">INVALID_URL_PROTOCOL</a></td>
<td>Error thrown <code>src</code> attribute's URL is <code>http</code>; <code>https</code> protocol required.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#implied-layout-isnt-supported-by-amp-tag">IMPLIED_LAYOUT_INVALID</a></td>
<td>Error thrown when implied layout set to <code>FIXED_HEIGHT</code>, <code>RESPONSIVE</code>, <code>FILL</code>, or <code>CONTAINER</code> as these aren't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#specified-layout-isnt-supported-by-amp-tag">SPECIFIED_LAYOUT_INVALID</a></td>
<td>Error thrown when specified layout set to <code>FIXED_HEIGHT</code>, <code>RESPONSIVE</code>, <code>FILL</code>, or <code>CONTAINER</code> as these aren't supported.</td>
</tr>
</table>

#### Behavior

Expand Down
55 changes: 52 additions & 3 deletions builtins/amp-video.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,58 @@ limitations under the License.

### <a name="amp-video"></a> `amp-video`

A replacement for the HTML5 `video` tag. Like all embedded external resources in a AMP file, the video is lazily loaded only when the `amp-video` element is in or near the viewport.

The `amp-video` component is only to be used for direct HTML5 video file embeds.
<table>
<tr>
<td width="40%"><strong>Description</strong></td>
<td>A replacement for the HTML5 <code>video</code> tag; only to be used for direct HTML5 video file embeds.</td>
</tr>
<tr>
<td width="40%"><strong>Availability</strong></td>
<td>Stable</td>
</tr>
<tr>
<td width="40%"><strong>Examples</strong></td>
<td><a href="https://github.com/ampproject/amphtml/blob/master/examples/everything.amp.html">everything.amp.html</a></td>
</tr>
</table>

The following lists validation errors specific to the `amp-video` tag
(see also `amp-video` in the [AMP validator specification](https://github.com/ampproject/amphtml/blob/master/validator/validator.protoascii):

<table>
<tr>
<th width="40%"><strong>Validation Error</strong></th>
<th>Description</th>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#mandatory-tag-ancestor-with-hint">MANDATORY_TAG_ANCESTOR_WITH_HINT</a></td>
<td>Error thrown if your AMP document uses <code>video</code> instead of <code>amp-video</code>. Error message: <code>The tag <code>video</code> may only appear as a descendant of tag <code>noscript</code>. Did you mean <code>amp-video</code>?</code>.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#missing-url">MISSING_URL</a></td>
<td>Error thrown when <code>src</code> attribute is missing it's URL.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url">INVALID_URL</a></td>
<td>Error thrown when <code>src</code> attribute's URL is invalid.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-url-protocol">INVALID_URL_PROTOCOL</a></td>
<td>Error thrown <code>src</code> attribute's URL is <code>http</code>; <code>https</code> protocol required.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#implied-layout-isnt-supported-by-amp-tag">IMPLIED_LAYOUT_INVALID</a></td>
<td>Error thrown when implied layout is set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#specified-layout-isnt-supported-by-amp-tag">SPECIFIED_LAYOUT_INVALID</a></td>
<td>Error thrown when specified layout is set to <code>CONTAINER</code>; this layout type isn't supported.</td>
</tr>
<tr>
<td width="40%"><a href="/docs/reference/validation_errors.html#invalid-property-value">INVALID_PROPERTY_VALUE_IN_ATTR_VALUE</a></td>
<td>Error thrown when invalid value is given for attributes <code>height</code> or <code>width</code>. For example, <code>height=auto</code> triggers this error for all supported layout types, with the exception of <code>NODISPLAY</code>.</td>
</tr>
</table>

#### Behavior

Expand Down
11 changes: 10 additions & 1 deletion examples/analytics.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,23 @@
</amp-analytics>
<!-- End comScore example -->

<!-- INFOnline example -->
<!--
INFOnline example
Important: url needs to point to a copy of
amp-analytics-infonline.html on a different subdomain
than your AMP files.
-->
<amp-analytics type="infonline" id="infonline">
<script type="application/json">
{
"vars": {
"st": "angebotskennung",
"co": "comment",
"cp": "code"
},
"requests": {
"url": "https://3p.ampproject.net/custom/amp-analytics-infonline.html"
}
}
</script>
Expand Down
Loading

0 comments on commit 4727058

Please sign in to comment.