- const sandbox = {
- location: {
- hash: '',
- href: '',
- protocol: 'http:'
- },
- history: {
- pushState: function(){}
- },
- document: {},
- navigator: {
- userAgent: ''
- },
- XMLHttpRequest: class XMLHttpRequest {},
- matchMedia: () => ({matches: () => {}, media: ''}),
- signature: %(signature)s,
- transformed_signature: null,
- g: function(){} // this is _yt_player
+ const fakeGlobal = {};
+ fakeGlobal.window = fakeGlobal;
+ fakeGlobal.location = {
+ hash: '',
+ host: 'www.youtube.com',
+ hostname: 'www.youtube.com',
+ href: 'https://www.youtube.com',
+ origin: 'https://www.youtube.com',
+ pathname: '/',
+ protocol: 'https:'
+ };
+ fakeGlobal.history = {
+ pushState: function(){}
+ };
+ fakeGlobal.document = {
+ location: fakeGlobal.location
+ };
+ fakeGlobal.document = {};
+ fakeGlobal.navigator = {
+ userAgent: ''