Skip to content

Replaced document by this.document #773 #787

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

Merged
merged 1 commit into from
Jun 30, 2020
Merged
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
22 changes: 11 additions & 11 deletions projects/lib/src/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -979,21 +979,21 @@ export class OAuthService extends AuthConfig implements OnDestroy {
);
}

if (typeof document === 'undefined') {
if (typeof this.document === 'undefined') {
throw new Error('silent refresh is not supported on this platform');
}

const existingIframe = document.getElementById(
const existingIframe = this.document.getElementById(
this.silentRefreshIFrameName
);

if (existingIframe) {
document.body.removeChild(existingIframe);
this.document.body.removeChild(existingIframe);
}

this.silentRefreshSubject = claims['sub'];

const iframe = document.createElement('iframe');
const iframe = this.document.createElement('iframe');
iframe.id = this.silentRefreshIFrameName;

this.setupSilentRefreshEventListener();
Expand All @@ -1005,7 +1005,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
if (!this.silentRefreshShowIFrame) {
iframe.style['display'] = 'none';
}
document.body.appendChild(iframe);
this.document.body.appendChild(iframe);
});

const errors = this.events.pipe(
Expand Down Expand Up @@ -1177,7 +1177,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
);
return false;
}
if (typeof document === 'undefined') {
if (typeof this.document === 'undefined') {
return false;
}

Expand Down Expand Up @@ -1299,20 +1299,20 @@ export class OAuthService extends AuthConfig implements OnDestroy {
return;
}

const existingIframe = document.getElementById(this.sessionCheckIFrameName);
const existingIframe = this.document.getElementById(this.sessionCheckIFrameName);
if (existingIframe) {
document.body.removeChild(existingIframe);
this.document.body.removeChild(existingIframe);
}

const iframe = document.createElement('iframe');
const iframe = this.document.createElement('iframe');
iframe.id = this.sessionCheckIFrameName;

this.setupSessionCheckEventListener();

const url = this.sessionCheckIFrameUrl;
iframe.setAttribute('src', url);
iframe.style.display = 'none';
document.body.appendChild(iframe);
this.document.body.appendChild(iframe);

this.startSessionCheckTimer();
}
Expand All @@ -1335,7 +1335,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
}

public checkSession(): void {
const iframe: any = document.getElementById(this.sessionCheckIFrameName);
const iframe: any = this.document.getElementById(this.sessionCheckIFrameName);

if (!iframe) {
this.logger.warn(
Expand Down