File tree Expand file tree Collapse file tree 8 files changed +53
-3
lines changed 
dev-packages/browser-integration-tests/suites/old-sdk-interop Expand file tree Collapse file tree 8 files changed +53
-3
lines changed Original file line number Diff line number Diff line change 1+ import  *  as  Sentry  from  '@sentry/browser' ; 
2+ 
3+ /** 
4+  * This simulates an relatively new v7 SDK setting acs on the __SENTRY__ carrier. 
5+  * see: https://github.com/getsentry/sentry-javascript/issues/12054 
6+  */ 
7+ window . __SENTRY__  =  { 
8+   acs : { 
9+     getCurrentScope : ( )  =>  { 
10+       return  'scope' ; 
11+     } , 
12+   } , 
13+ } ; 
14+ 
15+ window . Sentry  =  Sentry ; 
16+ 
17+ Sentry . init ( { 
18+   dsn : 'https://public@dsn.ingest.sentry.io/1337' , 
19+ } ) ; 
Original file line number Diff line number Diff line change 1+ const  sentryCarrier  =  window  &&  window . __SENTRY__ ; 
2+ 
3+ /** 
4+  * Simulate an old pre v8 SDK obtaining the hub from the global sentry carrier 
5+  * and checking for the hub version. 
6+  */ 
7+ const  res  =  sentryCarrier . acs  &&  sentryCarrier . acs . getCurrentScope ( ) ; 
8+ 
9+ // Write back result into the document 
10+ document . getElementById ( 'currentScope' ) . innerText  =  res  &&  'scope' ; 
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>  
2+ < html > 
3+   < head > 
4+     < meta  charset ="utf-8 " /> 
5+   </ head > 
6+   < body > 
7+     < p  id ="currentScope "> </ p > 
8+   </ body > 
9+ </ html > 
Original file line number Diff line number Diff line change 1+ import  {  expect  }  from  '@playwright/test' ; 
2+ 
3+ import  {  sentryTest  }  from  '../../../../utils/fixtures' ; 
4+ 
5+ sentryTest ( 
6+   "doesn't crash if older SDKs access `acs.getCurrentScope` on the global object" , 
7+   async  ( {  getLocalTestUrl,  page } )  =>  { 
8+     const  url  =  await  getLocalTestUrl ( {  testDir : __dirname  } ) ; 
9+     await  page . goto ( url ) ; 
10+ 
11+     await  expect ( page . locator ( '#currentScope' ) ) . toHaveText ( 'scope' ) ; 
12+   } , 
13+ ) ; 
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as Sentry from '@sentry/browser';
22
33/** 
44 * This simulates an old, pre-v8 SDK setting itself up on the global __SENTRY__ carrier. 
5+  * see: https://github.com/getsentry/sentry-javascript/issues/12155 
56 */ 
67window . __SENTRY__  =  { 
78  hub : { 
Original file line number Diff line number Diff line change @@ -8,5 +8,3 @@ const res = sentryCarrier.hub && sentryCarrier.hub.isOlderThan(7);
88
99// Write back result into the document 
1010document . getElementById ( 'olderThan' ) . innerText  =  res ; 
11- 
12- console . log ( sentryCarrier ) ; 
File renamed without changes.
Original file line number Diff line number Diff line change 11import  {  expect  }  from  '@playwright/test' ; 
22
3- import  {  sentryTest  }  from  '../../../utils/fixtures' ; 
3+ import  {  sentryTest  }  from  '../../../../ utils/fixtures' ; 
44
55sentryTest ( 
66  "doesn't crash if older SDKs access `hub.isOlderThan` on the global object" , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments