{"action":"opened","issue":{"url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1018","repository_url":"https://api.github.com/repos/Financial-Times/polyfill-service","labels_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1018/labels{/name}","comments_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1018/comments","events_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1018/events","html_url":"https://github.com/Financial-Times/polyfill-service/issues/1018","id":195075464,"number":1018,"title":"Rum=0 adds monitoring instead of disabling it","user":{"login":"thebuilder","id":3764345,"avatar_url":"https://avatars.githubusercontent.com/u/3764345?v=3","gravatar_id":"","url":"https://api.github.com/users/thebuilder","html_url":"https://github.com/thebuilder","followers_url":"https://api.github.com/users/thebuilder/followers","following_url":"https://api.github.com/users/thebuilder/following{/other_user}","gists_url":"https://api.github.com/users/thebuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/thebuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebuilder/subscriptions","organizations_url":"https://api.github.com/users/thebuilder/orgs","repos_url":"https://api.github.com/users/thebuilder/repos","events_url":"https://api.github.com/users/thebuilder/events{/privacy}","received_events_url":"https://api.github.com/users/thebuilder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T20:21:16Z","updated_at":"2016-12-12T20:21:16Z","closed_at":null,"body":"According to the [API reference](https://polyfill.io/v2/docs/api), you can set **rum=1** to enable performance monitoring, or **rum=0** to permanently disable it. \r\n\r\nHowever, setting it to either actually enables it and adds the script to the returned .js.\r\n\r\n### Output from Chrome with no rum\r\n> https://cdn.polyfill.io/v2/polyfill.min.js\r\n```\r\n/* Disable minification (remove `.min` from URL path) for more info */\r\n\r\n(function(undefined) {function _mutation(e){if(e.length){if(1===e.length)return\"string\"==typeof e[0]?document.createTextNode(e[0]):e[0];for(var t,n=document.createDocumentFragment(),r=e.length,o=-1;++o<r;)t=e[o],n.appendChild(\"string\"==typeof t?document.createTextNode(t):t);return n}throw new Error(\"DOM Exception 8\")}Document.prototype.after=Element.prototype.after=function(){this.parentNode&&this.parentNode.insertBefore(_mutation(arguments),this.nextSibling)},\"Text\"in this&&(Text.prototype.after=Element.prototype.after);Document.prototype.append=Element.prototype.append=function(){this.appendChild(_mutation(arguments))};Document.prototype.before=Element.prototype.before=function(){this.parentNode&&this.parentNode.insertBefore(_mutation(arguments),this)},\"Text\"in this&&(Text.prototype.before=Element.prototype.before);Document.prototype.prepend=Element.prototype.prepend=function(){this.insertBefore(_mutation(arguments),this.firstChild)};Document.prototype.replaceWith=Element.prototype.replaceWith=function(){this.parentNode&&this.parentNode.replaceChild(_mutation(arguments),this)},\"Text\"in this&&(Text.prototype.replaceWith=Element.prototype.replaceWith);}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\r\n```\r\n\r\n### Output from Chrome with rum=0\r\n> https://cdn.polyfill.io/v2/polyfill.min.js?rum=0\r\n```\r\n/* Disable minification (remove `.min` from URL path) for more info */\r\n\r\n(function(undefined) {(function() {\r\n\tvar beacon = new Image();\r\n\tbeacon.src = '//polyfill.io/v2/recordRumData?X' + \r\n\t\"&Array.from=\" + (('from' in Array && (function () {\r\n\ttry {\r\n\t\tArray.from({ length: -Infinity });\r\n\r\n\t\treturn true;\r\n\t} catch (e) {\r\n\t\treturn false;\r\n\t}\r\n})())?1:0) +\t\"&Array.isArray=\" + (('isArray' in Array)?1:0) +\t\"&Array.of=\" + (('of' in Array)?1:0) +\t\"&Array.prototype.every=\" + (('every' in Array.prototype)?1:0) +\t\"&Array.prototype.fill=\" + (('fill' in Array.prototype)?1:0) +\t\"&Array.prototype.filter=\" + (('filter' in Array.prototype)?1:0) +\t\"&Array.prototype.forEach=\" + (('forEach' in Array.prototype)?1:0) +\t\"&Array.prototype.indexOf=\" + (('indexOf' in Array.prototype)?1:0) +\t\"&Array.prototype.lastIndexOf=\" + (('lastIndexOf' in Array.prototype)?1:0) +\t\"&Array.prototype.map=\" + (('map' in Array.prototype)?1:0) +\t\"&Array.prototype.reduce=\" + (('reduce' in Array.prototype)?1:0) +\t\"&Array.prototype.reduceRight=\" + (('reduceRight' in Array.prototype)?1:0) +\t\"&Array.prototype.some=\" + (('some' in Array.prototype)?1:0) +\t\"&CustomEvent=\" + (('CustomEvent' in this &&\r\n\r\n// In Safari, typeof CustomEvent == 'object' but it otherwise works fine\r\n(typeof this.CustomEvent === 'function' ||\r\n(this.CustomEvent.toString().indexOf('CustomEventConstructor')>-1)))?1:0) +\t\"&DOMTokenList=\" + (('DOMTokenList' in this && (function (x) {\r\n\treturn 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;\r\n})(document.createElement('x')))?1:0) +\t\"&Date.now=\" + (('Date' in this && 'now' in this.Date && 'getTime' in this.Date.prototype)?1:0) +\t\"&Date.prototype.toISOString=\" + (('Date' in this && 'toISOString' in Date.prototype)?1:0) +\t\"&Document=\" + ((\"Document\" in this)?1:0) +\t\"&Element.prototype.after=\" + (('Element' in this && 'after' in Element.prototype)?1:0) +\t\"&Element.prototype.append=\" + (('Element' in this && 'append' in Element.prototype)?1:0) +\t\"&Element.prototype.before=\" + (('Element' in this && 'before' in Element.prototype)?1:0) +\t\"&Element.prototype.classList=\" + (('document' in this && \"classList\" in document.documentElement)?1:0) +\t\"&Element.prototype.cloneNode=\" + (('document' in this && \"cloneNode\" in document.documentElement && (function() {\r\n\tvar test = document.createElement('input');\r\n\ttest.checked = true;\r\n\tvar result = test.cloneNode();\r\n\treturn !!result.checked;\r\n})())?1:0) +\t\"&Element.prototype.closest=\" + (('document' in this && \"closest\" in document.documentElement)?1:0) +\t\"&Element.prototype.matches=\" + (('document' in this && \"matches\" in document.documentElement)?1:0) +\t\"&Element.prototype.prepend=\" + (('Element' in this && 'prepend' in Element.prototype)?1:0) +\t\"&Element.prototype.remove=\" + (('Element' in this && 'remove' in Element.prototype)?1:0) +\t\"&Element.prototype.replaceWith=\" + (('Element' in this && 'replaceWith' in Element.prototype)?1:0) +\t\"&Element=\" + (('Element' in this && 'HTMLElement' in this)?1:0) +\t\"&Event.hashchange=\" + (('onhashchange' in this && this.onhashchange !== null)?1:0) +\t\"&Event=\" + (((function(global) {\r\n\r\n\tif (!('Event' in global)) return false;\r\n\tif (typeof global.Event === 'function') return true;\r\n\r\n\ttry {\r\n\r\n\t\t// In IE 9-11, the Event object exists but cannot be instantiated\r\n\t\tnew Event('click');\r\n\t\treturn true;\r\n\t} catch(e) {\r\n\t\treturn false;\r\n\t}\r\n}(this)))?1:0) +\t\"&Function.prototype.bind=\" + (('bind' in Function.prototype)?1:0) +\t\"&JSON=\" + (('JSON' in this)?1:0) +\t\"&Map=\" + (('Map' in this && (function() {\r\n\ttry {\r\n\t\treturn (new Map([[1,1], [2,2]])).size === 2;\r\n\t} catch (e) {\r\n\t\treturn false;\r\n\t}\r\n}()))?1:0) +\t\"&Node.prototype.contains=\" + ((document.contains)?1:0) +\t\"&Number.isNaN=\" + (('isNaN' in Number)?1:0) +\t\"&Object.assign=\" + (('assign' in Object)?1:0) +\t\"&Object.create=\" + (('create' in Object)?1:0) +\t\"&Object.defineProperties=\" + (('defineProperties' in Object)?1:0) +\t\"&Object.defineProperty=\" + ((// In IE8, defineProperty could only act on DOM elements, so full support\r\n// for the feature requires the ability to set a property on an arbitrary object\r\n'defineProperty' in Object && (function() {\r\n\ttry {\r\n\t\tvar a = {};\r\n\t\tObject.defineProperty(a, 'test', {value:42});\r\n\t\treturn true;\r\n\t} catch(e) {\r\n\t\treturn false\r\n\t}\r\n}()))?1:0) +\t\"&Object.getOwnPropertyDescriptor=\" + (('getOwnPropertyDescriptor' in Object && typeof Object.getOwnPropertyDescriptor === 'function' && (function() {\r\n    try {\r\n    \tvar object = {};\r\n        object.test = 0;\r\n        return Object.getOwnPropertyDescriptor(\r\n            object,\r\n            \"test\"\r\n        ).value === 0;\r\n    } catch (exception) {\r\n        return false\r\n    }\r\n}()))?1:0) +\t\"&Object.getOwnPropertyNames=\" + (('getOwnPropertyNames' in Object)?1:0) +\t\"&Object.getPrototypeOf=\" + (('getPrototypeOf' in Object)?1:0) +\t\"&Object.keys=\" + (('keys' in Object)?1:0) +\t\"&Promise=\" + (('Promise' in this)?1:0) +\t\"&Set=\" + (('Set' in this && (function() {\r\n\treturn (new Set([1,2])).size === 2;\r\n}()))?1:0) +\t\"&String.prototype.endsWith=\" + (('endsWith' in String.prototype)?1:0) +\t\"&String.prototype.includes=\" + (('includes' in String.prototype)?1:0) +\t\"&String.prototype.startsWith=\" + (('startsWith' in String.prototype)?1:0) +\t\"&String.prototype.trim=\" + (('trim' in String.prototype)?1:0) +\t\"&URL=\" + (((function (global) {\r\n\t/*\r\n\t * Browsers may have:\r\n\t * No global URL object\r\n\t * URL with static methods only - may have a dummy constructor\r\n\t * URL with members except searchParams\r\n\t * Full URL API support\r\n\t */\r\n\t'use strict';\r\n\r\n\ttry {\r\n\t\tvar nativeURL = new global.URL('http://example.com');\r\n\r\n\t\treturn 'href' in nativeURL && 'searchParams' in nativeURL;\r\n\t}\r\n\tcatch (error) {\r\n\t\treturn false;\r\n\t}\r\n}(this)))?1:0) +\t\"&Window=\" + (('Window' in this)?1:0) +\t\"&XMLHttpRequest=\" + (('XMLHttpRequest' in this && 'prototype' in this.XMLHttpRequest && 'addEventListener' in this.XMLHttpRequest.prototype)?1:0) +\t\"&atob=\" + (('atob' in this)?1:0) +\t\"&document.querySelector=\" + (('document' in this && 'querySelector' in this.document)?1:0) +\t\"&document.visibilityState=\" + (('document' in this && 'hidden' in document && 'visibilityState' in document)?1:0) +\t\"&location.origin=\" + (('location' in this && 'origin' in this.location)?1:0) +\t\"&requestAnimationFrame=\" + (('requestAnimationFrame' in this)?1:0) +\t\"&~html5-elements=\" + ((// Primitive detect for HTML5 element support - add a <section> element and check that it acquires block display mode by default\r\n(function() {\r\n\tvar p = document.createElement('p');\r\n\tvar result = false;\r\n\tp.innerHTML = '<section></section>';\r\n\tdocument.documentElement.appendChild(p);\r\n\tif (p.firstChild) {\r\n\t\tif ('getComputedStyle' in window) {\r\n\t\t\tresult = (getComputedStyle(p.firstChild).display === 'block');\r\n\t\t} else if (p.firstChild.currentStyle) {\r\n\t\t\tresult = (p.firstChild.currentStyle.display === 'block');\r\n\t\t}\r\n\t}\r\n\tdocument.documentElement.removeChild(p);\r\n\treturn result;\r\n})())?1:0) +\t\"&Symbol=\" + (('Symbol' in this)?1:0) +\t\"&Symbol.iterator=\" + (('Symbol' in this && 'iterator' in this.Symbol)?1:0) +\t\"&Symbol.species=\" + (('Symbol' in this && 'species' in this.Symbol)?1:0) +\t\"&setImmediate=\" + (('setImmediate' in this)?1:0) +\t\"&performance.now=\" + (('performance' in this && 'now' in this.performance)?1:0) +\r\n\t(('performance' in window && 'getEntriesByType' in window.performance && 'find' in Array.prototype) ? (function() {\r\n\t\tvar rec = window.performance.getEntriesByType(\"resource\").find(function(rec) { return rec.name.indexOf('/v2/polyfill.') !== -1; });\r\n\t\treturn rec ? '&dns='+(rec.domainLookupEnd-rec.domainLookupStart)+\r\n\t\t'&connect='+(rec.connectEnd-rec.connectStart)+\r\n\t\t'&req='+(rec.responseStart-rec.requestStart)+\r\n\t\t'&resp='+(rec.responseEnd-rec.responseStart) : '';\r\n\t}()) : '');\r\n}());\r\nfunction _mutation(e){if(e.length){if(1===e.length)return\"string\"==typeof e[0]?document.createTextNode(e[0]):e[0];for(var t,n=document.createDocumentFragment(),r=e.length,o=-1;++o<r;)t=e[o],n.appendChild(\"string\"==typeof t?document.createTextNode(t):t);return n}throw new Error(\"DOM Exception 8\")}Document.prototype.after=Element.prototype.after=function(){this.parentNode&&this.parentNode.insertBefore(_mutation(arguments),this.nextSibling)},\"Text\"in this&&(Text.prototype.after=Element.prototype.after);Document.prototype.append=Element.prototype.append=function(){this.appendChild(_mutation(arguments))};Document.prototype.before=Element.prototype.before=function(){this.parentNode&&this.parentNode.insertBefore(_mutation(arguments),this)},\"Text\"in this&&(Text.prototype.before=Element.prototype.before);Document.prototype.prepend=Element.prototype.prepend=function(){this.insertBefore(_mutation(arguments),this.firstChild)};Document.prototype.replaceWith=Element.prototype.replaceWith=function(){this.parentNode&&this.parentNode.replaceChild(_mutation(arguments),this)},\"Text\"in this&&(Text.prototype.replaceWith=Element.prototype.replaceWith);}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\r\n```\r\n"}}
{"actor":{"display_login":"thebuilder"}}