Skip to content
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

Remove globalDocumentState service #24660

Merged
merged 1 commit into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions build-system/tasks/presubmit-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,6 @@ const forbiddenTerms = {
'src/service/crypto-impl.js',
],
},
'installGlobalDocumentStateService': {
message: privateServiceFactory,
whitelist: [
'src/runtime.js',
'src/service/core-services.js',
'src/service/document-state.js',
],
},
'installDocService': {
message: privateServiceFactory,
whitelist: [
Expand Down Expand Up @@ -429,15 +421,6 @@ const forbiddenTerms = {
'extensions/amp-consent/0.1/consent-state-manager.js',
],
},
// Global documentState service.
'globalDocumentStateFor': {
message: 'Global document API. In the process of being deprecated.',
whitelist: [
'src/services.js',
'src/service/viewer-impl.js',
'src/service/vsync-impl.js',
],
},
'getBaseCid': {
message: requiresReviewPrivacy,
whitelist: ['src/service/cid-impl.js', 'src/service/viewer-impl.js'],
Expand Down
2 changes: 0 additions & 2 deletions src/service/core-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {installBatchedXhrService} from './batched-xhr-impl';
import {installCidService} from './cid-impl';
import {installCryptoService} from './crypto-impl';
import {installDocumentInfoServiceForDoc} from './document-info-impl';
import {installGlobalDocumentStateService} from './document-state';
import {installGlobalNavigationHandlerForDoc} from './navigation';
import {installGlobalSubmitListenerForDoc} from '../document-submit';
import {installHiddenObserverForDoc} from './hidden-observer-impl';
Expand Down Expand Up @@ -62,7 +61,6 @@ export function installBuiltinElements(win) {
export function installRuntimeServices(global) {
installCryptoService(global);
installBatchedXhrService(global);
installGlobalDocumentStateService(global);
installPlatformService(global);
installTemplatesService(global);
installTimerService(global);
Expand Down
89 changes: 0 additions & 89 deletions src/service/document-state.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,6 @@ export class Services {
));
}

/**
* @param {!Window} window
* @return {!./service/document-state.DocumentState}
* @restricted Only to be used for global document services, such as vsync.
*/
static globalDocumentStateFor(window) {
return getService(window, 'documentState');
}

/**
* Returns service to listen for `hidden` attribute mutations.
* @param {!Element|!ShadowRoot} element
Expand Down
3 changes: 0 additions & 3 deletions test/unit/test-activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {AmpDocSingle} from '../../src/service/ampdoc-impl';
import {Observable} from '../../src/observable';
import {Services} from '../../src/services';
import {installActivityServiceForTesting} from '../../extensions/amp-analytics/0.1/activity-impl';
import {installGlobalDocumentStateService} from '../../src/service/document-state';
import {installPlatformService} from '../../src/service/platform-impl';
import {installTimerService} from '../../src/service/timer-impl';
import {installViewerServiceForDoc} from '../../src/service/viewer-impl';
Expand Down Expand Up @@ -102,7 +101,6 @@ describe('Activity getTotalEngagedTime', () => {
},
};

installGlobalDocumentStateService(fakeWin);
installTimerService(fakeWin);
installVsyncService(fakeWin);
installPlatformService(fakeWin);
Expand Down Expand Up @@ -318,7 +316,6 @@ describe('Activity getIncrementalEngagedTime', () => {
},
};

installGlobalDocumentStateService(fakeWin);
installTimerService(fakeWin);
installVsyncService(fakeWin);
installPlatformService(fakeWin);
Expand Down
2 changes: 0 additions & 2 deletions test/unit/test-cid.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {installCryptoPolyfill} from '../../extensions/amp-crypto-polyfill/0.1/am
import {installDocService} from '../../src/service/ampdoc-impl';
import {installDocumentInfoServiceForDoc} from '../../src/service/document-info-impl';
import {installExtensionsService} from '../../src/service/extensions-impl';
import {installGlobalDocumentStateService} from '../../src/service/document-state';
import {installPlatformService} from '../../src/service/platform-impl';
import {installTimerService} from '../../src/service/timer-impl';
import {installViewerServiceForDoc} from '../../src/service/viewer-impl';
Expand Down Expand Up @@ -104,7 +103,6 @@ describes.sandboxed('cid', {}, () => {
};
fakeWin.document.defaultView = fakeWin;
installDocService(fakeWin, /* isSingleDoc */ true);
installGlobalDocumentStateService(fakeWin);
ampdoc = Services.ampdocServiceFor(fakeWin).getSingleDoc();
installTimerService(fakeWin);
installPlatformService(fakeWin);
Expand Down
3 changes: 0 additions & 3 deletions test/unit/test-custom-element-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
upgradeOrRegisterElement,
} from '../../src/service/custom-element-registry';
import {createElementWithAttributes} from '../../src/dom';
import {installGlobalDocumentStateService} from '../../src/service/document-state';

describes.realWin('CustomElement register', {amp: true}, env => {
class ConcreteElement extends BaseElement {}
Expand Down Expand Up @@ -208,8 +207,6 @@ describes.realWin('CustomElement register', {amp: true}, env => {
doc.defaultView = win;

ampdoc = new AmpDocSingle(win);

installGlobalDocumentStateService(win);
});

afterEach(() => {
Expand Down
92 changes: 0 additions & 92 deletions test/unit/test-document-state.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/unit/test-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
getServicePromiseOrNullForDoc,
} from '../../src/service';
import {installAmpdocServices} from '../../src/service/core-services';
import {installGlobalDocumentStateService} from '../../src/service/document-state';
import {installPlatformService} from '../../src/service/platform-impl';
import {installTimerService} from '../../src/service/timer-impl';
import {setShadowDomSupportedVersionForTesting} from '../../src/web-components';
Expand Down Expand Up @@ -68,7 +67,6 @@ describes.fakeWin(
const ampdoc = new AmpDocSingle(win);
ampdocService.getSingleDoc = () => ampdoc;
ampdocService.getAmpDoc = () => ampdoc;
installGlobalDocumentStateService(win);
installPlatformService(win);
installTimerService(win);
vsyncForTesting(win);
Expand Down
2 changes: 0 additions & 2 deletions test/unit/test-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {ViewerImpl} from '../../src/service/viewer-impl';
import {dev} from '../../src/log';
import {installDocService} from '../../src/service/ampdoc-impl';
import {installDocumentInfoServiceForDoc} from '../../src/service/document-info-impl';
import {installGlobalDocumentStateService} from '../../src/service/document-state';
import {installPlatformService} from '../../src/service/platform-impl';
import {installTimerService} from '../../src/service/timer-impl';
import {
Expand Down Expand Up @@ -112,7 +111,6 @@ describes.sandboxed('Viewer', {}, () => {
windowApi.location.href = url;
});
installDocService(windowApi, /* isSingleDoc */ true);
installGlobalDocumentStateService(windowApi);
ampdoc = Services.ampdocServiceFor(windowApi).getSingleDoc();

params = {'origin': 'g.com'};
Expand Down
4 changes: 0 additions & 4 deletions test/unit/test-viewport-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {Services} from '../../src/services';
import {ViewportBindingIosEmbedWrapper_} from '../../src/service/viewport/viewport-binding-ios-embed-wrapper';
import {ViewportBindingNatural_} from '../../src/service/viewport/viewport-binding-natural';
import {installDocService} from '../../src/service/ampdoc-impl';
import {installGlobalDocumentStateService} from '../../src/service/document-state';
import {installPlatformService} from '../../src/service/platform-impl';
import {installVsyncService} from '../../src/service/vsync-impl';
import {toggleExperiment} from '../../src/experiments';
Expand Down Expand Up @@ -47,7 +46,6 @@ describes.realWin('ViewportBindingNatural', {ampCss: true}, env => {
installPlatformService(win);
installVsyncService(win);
installDocService(win, /* isSingleDoc */ true);
installGlobalDocumentStateService(win);
ampdoc = Services.ampdocServiceFor(win).getSingleDoc();
binding = new ViewportBindingNatural_(ampdoc);
binding.connect();
Expand Down Expand Up @@ -244,7 +242,6 @@ describes.realWin('ViewportBindingNatural on iOS', {ampCss: true}, env => {
installPlatformService(win);
installVsyncService(win);
installDocService(win, /* isSingleDoc */ true);
installGlobalDocumentStateService(win);
ampdoc = Services.ampdocServiceFor(win).getSingleDoc();
sandbox.stub(Services.platformFor(win), 'isIos').returns(true);
binding = new ViewportBindingNatural_(ampdoc);
Expand Down Expand Up @@ -281,7 +278,6 @@ describes.realWin('ViewportBindingIosEmbedWrapper', {ampCss: true}, env => {
child.textContent = 'test';
win.document.body.appendChild(child);
installDocService(win, /* isSingleDoc */ true);
installGlobalDocumentStateService(win);
installVsyncService(win);
installPlatformService(win);
vsync = Services.vsyncFor(win);
Expand Down
Loading