Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
meta(changelog): Update changelog for 10.46.0#19973
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
86f5dc844fd627399df7c8d14deaccf337a02744f7ffe7a6fffe00a70684e2dda2ff20b4c4bbfbd451fcb978b797531ac45e99593e9bf658c167cf2ddca82ac1a7b22587cc6c344b774ebcb5170d4feb294cb94fce11ba2cac4c46b4071ef8808ea170387b58fc035acf60d03232317c3fafdb4b7f5d09907d06c66b48de51e2cee83cabf3c9812ae18a624e0156846a54de0454abb356f48cc4File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| { | ||
| "env": { "ENABLE_LSP_TOOL": "1" }, | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(find:*)", | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /** | ||
| * Test that verifies thenable objects with extra methods (like jQuery's jqXHR) | ||
| * preserve those methods when returned from Sentry.startSpan(). | ||
| * | ||
| * Example case: | ||
| * const jqXHR = Sentry.startSpan({ name: "test" }, () => $.ajax(...)); | ||
| * jqXHR.abort(); // Should work and not throw an error because of missing abort() method | ||
| */ | ||
| // Load jQuery from CDN | ||
| const script = document.createElement('script'); | ||
| script.src = 'https://code.jquery.com/jquery-3.7.1.min.js'; | ||
| script.integrity = 'sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo='; | ||
| script.crossOrigin = 'anonymous'; | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| script.onload = function () { | ||
| runTest(); | ||
| }; | ||
| script.onerror = function () { | ||
| window.jqXHRTestError = 'Failed to load jQuery'; | ||
| window.jqXHRMethodsPreserved = false; | ||
| }; | ||
| document.head.appendChild(script); | ||
| async function runTest() { | ||
| window.jqXHRAbortCalled = false; | ||
| window.jqXHRAbortResult = null; | ||
| window.jqXHRTestError = null; | ||
| try { | ||
| if (!window.jQuery) { | ||
| throw new Error('jQuery not loaded'); | ||
| } | ||
| const result = Sentry.startSpan({ name: 'test-jqxhr', op: 'http.client' }, () => { | ||
| // Make a real AJAX request with jQuery | ||
| return window.jQuery.ajax({ | ||
| url: 'https://httpbin.org/status/200', | ||
| method: 'GET', | ||
| timeout: 5000, | ||
| }); | ||
| }); | ||
| const hasAbort = typeof result.abort === 'function'; | ||
| const hasReadyState = 'readyState' in result; | ||
| if (hasAbort && hasReadyState) { | ||
| try { | ||
| result.abort(); | ||
| window.jqXHRAbortCalled = true; | ||
| window.jqXHRAbortResult = 'abort-successful'; | ||
| window.jqXHRMethodsPreserved = true; | ||
| } catch (e) { | ||
| console.log('abort() threw an error:', e); | ||
| window.jqXHRTestError = `abort() failed: ${e.message}`; | ||
| window.jqXHRMethodsPreserved = false; | ||
| } | ||
| } else { | ||
| window.jqXHRMethodsPreserved = false; | ||
| window.jqXHRTestError = 'jqXHR methods not preserved'; | ||
| } | ||
| // Since we aborted the request, it should be rejected | ||
| try { | ||
| await result; | ||
| window.jqXHRPromiseResolved = true; // Unexpected | ||
| } catch (err) { | ||
| // Expected: aborted request rejects | ||
| window.jqXHRPromiseResolved = false; | ||
| window.jqXHRPromiseRejected = true; | ||
| } | ||
| } catch (error) { | ||
| console.error('Test error:', error); | ||
| window.jqXHRTestError = error.message; | ||
| window.jqXHRMethodsPreserved = false; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { sentryTest } from '../../../../utils/fixtures'; | ||
| import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../../utils/helpers'; | ||
| sentryTest('preserves extra methods on real jQuery jqXHR objects', async ({ getLocalTestUrl, page }) => { | ||
| if (shouldSkipTracingTest()) { | ||
| sentryTest.skip(); | ||
| } | ||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
| const transactionPromise = waitForTransactionRequest(page); | ||
| await page.goto(url); | ||
| // Wait for jQuery to load | ||
| await page.waitForTimeout(1000); | ||
| const methodsPreserved = await page.evaluate(() => (window as any).jqXHRMethodsPreserved); | ||
| expect(methodsPreserved).toBe(true); | ||
| const abortCalled = await page.evaluate(() => (window as any).jqXHRAbortCalled); | ||
| expect(abortCalled).toBe(true); | ||
| const abortReturnValue = await page.evaluate(() => (window as any).jqXHRAbortResult); | ||
| expect(abortReturnValue).toBe('abort-successful'); | ||
| const testError = await page.evaluate(() => (window as any).jqXHRTestError); | ||
| expect(testError).toBeNull(); | ||
| const transaction = envelopeRequestParser(await transactionPromise); | ||
| expect(transaction.transaction).toBe('test-jqxhr'); | ||
| expect(transaction.spans).toBeDefined(); | ||
| }); | ||
| sentryTest('aborted request rejects promise correctly', async ({ getLocalTestUrl, page }) => { | ||
| if (shouldSkipTracingTest()) { | ||
| sentryTest.skip(); | ||
| } | ||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
| await page.goto(url); | ||
| // Wait for jQuery to load | ||
| await page.waitForTimeout(1000); | ||
| const promiseRejected = await page.evaluate(() => (window as any).jqXHRPromiseRejected); | ||
| expect(promiseRejected).toBe(true); | ||
| const promiseResolved = await page.evaluate(() => (window as any).jqXHRPromiseResolved); | ||
| expect(promiseResolved).toBe(false); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.