Allow for master frame to be shared across networks who explicitly opt-in
Doubleclick and AdSense need to track the number of slots on the page across networks as part of pageview accounting. Currently this is done via the master frame however master frame allocates by including the frame type (see https://github.com/ampproject/amphtml/blob/master/3p/ampcontext-integration.js#L31) preventing this information from being accessible.
Proposed fix is to add a config option that allows for networks to explicitly allow shared master frame state between them. The config would include an array of whitelist networks (e.g. for doubleclick: masterFrameAccessibleTypes: ['adsense']). The name attribute defining the master frame would them change from:
const masterName = 'frame_' + type + '_master';
To:
const allowedTypes = config.masterFrameAccessibleTypes || [];
allowedTypes.push(type);
// Sort to ensure consistency across types.
const masterName = frame_${allowedTypes.sort().join()}_master;
/cc @ampproject/a4a @lannka