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

Add better support for referencing global objects from a window and web workers #1167

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

MSNev
Copy link
Collaborator

@MSNev MSNev commented Jan 27, 2020

No description provided.

@MSNev MSNev requested a review from a team as a code owner January 27, 2020 03:43
Assert.ok(false, e.toString());

completed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this completed duplicated with this._testCompleted? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No _testCompleted is a method, this is a flag to indicated that no additional steps should be processed.

msg += "\n" + idx + ":" + value;
});
}
Assert.ok(false, msg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is msg false, isn't it always has a value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that the message is always logged into the output, as this is only called when the tests fail.

@MSNev MSNev force-pushed the MSNev/AddGlobalThisSupport branch 2 times, most recently from 3d7bf2d to cf36ab7 Compare January 27, 2020 21:27
setTimeout(() => {
trigger();
}, testInfo.stepDelay);
if (!completed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file (and others) is shared between all other extensions and packages in this repo. In a separate PR we should probably share all of these files between all of them in case we ever need these changes in another package.

@@ -597,7 +603,7 @@ export class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsi
instance._onerror({
message: error.reason.toString(),
error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),
url: _window.location.href,
url: _location ? _location.href : "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this causing issues before? This is changed behavior, but I don't think its preferred to send empty string here anyways.

const originalFetch: (input?: Request | string, init?: RequestInit) => Promise<Response> = _window.fetch;

// Getting the global instance tp support web workers (which don't have window)
let global = getGlobal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be named _global?

@@ -128,10 +213,8 @@ export function hasJSON(): boolean {
*/
export function getJSON(): JSON | null {
if (hasJSON()) {
return JSON;
return JSON || getGlobalInst(strJSON);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the JSON || part here still necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Server Side Rendering fails when using Gatsby
3 participants