1{"version":3,"sources":["webpack:///webpack/bootstrap f840e51d38912f8e8968","webpack:///./system-addon/common/Actions.jsm","webpack:///external \"React\"","webpack:///external \"ReactIntl\"","webpack:///(webpack)/buildin/global.js","webpack:///external \"ReactRedux\"","webpack:///./system-addon/content-src/components/TopSites/TopSitesConstants.js","webpack:///./system-addon/common/Dedupe.jsm","webpack:///./system-addon/common/Reducers.jsm","webpack:///./system-addon/content-src/components/ErrorBoundary/ErrorBoundary.jsx","webpack:///./system-addon/content-src/lib/link-menu-options.js","webpack:///./system-addon/content-src/components/LinkMenu/LinkMenu.jsx","webpack:///./system-addon/content-src/components/ContextMenu/ContextMenu.jsx","webpack:///./system-addon/content-src/components/CollapsibleSection/CollapsibleSection.jsx","webpack:///./system-addon/content-src/components/ComponentPerfTimer/ComponentPerfTimer.jsx","webpack:///./system-addon/common/PerfService.jsm","webpack:///./system-addon/content-src/components/TopSites/TopSite.jsx","webpack:///./system-addon/content-src/activity-stream.jsx","webpack:///./system-addon/content-src/lib/snippets.js","webpack:///./system-addon/content-src/components/ConfirmDialog/ConfirmDialog.jsx","webpack:///./system-addon/content-src/components/ManualMigration/ManualMigration.jsx","webpack:///./system-addon/content-src/components/PreferencesPane/PreferencesPane.jsx","webpack:///./system-addon/common/PrerenderData.jsm","webpack:///./system-addon/content-src/components/Search/Search.jsx","webpack:///./system-addon/content-src/components/Base/Base.jsx","webpack:///./system-addon/content-src/lib/constants.js","webpack:///./system-addon/content-src/components/Sections/Sections.jsx","webpack:///./system-addon/content-src/components/Card/types.js","webpack:///./system-addon/content-src/components/Card/Card.jsx","webpack:///./system-addon/content-src/lib/section-menu-options.js","webpack:///./system-addon/content-src/components/SectionMenu/SectionMenu.jsx","webpack:///./system-addon/content-src/components/Topics/Topics.jsx","webpack:///./system-addon/content-src/components/TopSites/TopSites.jsx","webpack:///./system-addon/content-src/components/TopSites/TopSiteFormInput.jsx","webpack:///./system-addon/content-src/components/TopSites/TopSiteForm.jsx","webpack:///./system-addon/content-src/lib/detect-user-session-start.js","webpack:///./system-addon/content-src/lib/init-store.js","webpack:///external \"Redux\"","webpack:///external \"ReactDOM\""],"names":["globalImportContext","Window","BACKGROUND_PROCESS","UI_CODE","actionTypes","type","_RouteMessage","action","options","meta","Object","assign","from","to","Error","forEach","o","AlsoToMain","fromTarget","skipLocal","CONTENT_MESSAGE_TYPE","MAIN_MESSAGE_TYPE","OnlyToMain","BroadcastToContent","AlsoToOneContent","target","skipMain","toTarget","OnlyToOneContent","AlsoToPreloaded","PRELOAD_MESSAGE_TYPE","UserEvent","data","TELEMETRY_USER_EVENT","UndesiredEvent","importContext","TELEMETRY_UNDESIRED_EVENT","PerfEvent","TELEMETRY_PERFORMANCE_EVENT","ImpressionStats","TELEMETRY_IMPRESSION_STATS","SetPref","name","value","SET_PREF","WebExtEvent","source","isSendToMain","isBroadcastToContent","isSendToOneContent","isSendToPreloaded","isFromMain","getPortIdOfSender","TOP_SITES_SOURCE","TOP_SITES_CONTEXT_MENU_OPTIONS","MIN_RICH_FAVICON_SIZE","MIN_CORNER_FAVICON_SIZE","Dedupe","constructor","createKey","defaultCreateKey","item","group","groups","globalKeys","Set","result","values","valueMap","Map","key","has","set","push","add","map","m","Array","TOP_SITES_DEFAULT_ROWS","TOP_SITES_MAX_SITES_PER_ROW","dedupe","site","url","INITIAL_STATE","App","initialized","version","Snippets","TopSites","rows","editForm","Prefs","Dialog","visible","Sections","PreferencesPane","prevState","at","INIT","insertPinned","links","pinned","pinnedUrls","link","newLinks","filter","includes","isPinned","pinIndex","val","index","length","splice","hasMatch","newRows","TOP_SITES_UPDATED","TOP_SITES_EDIT","TOP_SITES_CANCEL_EDIT","SCREENSHOT_UPDATED","row","screenshot","PLACES_BOOKMARK_ADDED","bookmarkGuid","bookmarkTitle","dateAdded","bookmarkDateCreated","PLACES_BOOKMARK_REMOVED","newSite","DIALOG_OPEN","DIALOG_CANCEL","DELETE_HISTORY_URL","newValues","PREFS_INITIAL_VALUES","PREF_CHANGED","newState","SECTION_DEREGISTER","section","id","SECTION_REGISTER","title","enabled","SECTION_UPDATE","find","card","dedupeConfigurations","dedupeConf","dedupedRows","dedupeFrom","reduce","dedupeSectionId","dedupeSection","s","SECTION_UPDATE_CARD","PLACES_SAVED_TO_POCKET","open_url","pocket_id","PLACES_LINKS_DELETED","PLACES_LINK_BLOCKED","DELETE_FROM_POCKET","ARCHIVE_FROM_POCKET","SNIPPETS_DATA","SNIPPET_BLOCKED","blockList","concat","SNIPPETS_BLOCKLIST_CLEARED","SNIPPETS_RESET","SETTINGS_OPEN","SETTINGS_CLOSE","ErrorBoundaryFallback","React","PureComponent","props","windowObj","window","onClick","bind","location","reload","render","defaultClass","className","defaultProps","ErrorBoundary","state","hasError","componentDidCatch","error","info","setState","children","FallbackComponent","_OpenInPrivateWindow","icon","ac","OPEN_PRIVATE_WINDOW","referrer","userEvent","LinkMenuOptions","Separator","EmptyItem","RemoveBookmark","DELETE_BOOKMARK_BY_ID","AddBookmark","BOOKMARK_URL","OpenInNewWindow","OPEN_NEW_WINDOW","BlockUrl","eventSource","BLOCK_URL","impression","block","tiles","guid","pos","WebExtDismiss","string_id","WEBEXT_DISMISS","action_position","DeleteUrl","isEnabled","siteInfo","onConfirm","forceBlock","event","body_string_id","confirm_button_string_id","cancel_button_string_id","PinTopSite","TOP_SITES_PIN","UnpinTopSite","TOP_SITES_UNPIN","SaveToPocket","SAVE_TO_POCKET","pocket","DeleteFromPocket","ArchiveFromPocket","EditTopSite","CheckBookmark","CheckPinTopSite","CheckSavedToPocket","CheckBookmarkOrArchive","CheckDeleteHistoryOrEmpty","OpenInPrivateWindow","DEFAULT_SITE_MENU_OPTIONS","getOptions","isPrivateBrowsingEnabled","propOptions","isDefault","option","label","intl","formatMessage","dispatch","userEventData","shouldSendImpressionStats","first","last","onUpdate","getState","LinkMenu","connect","injectIntl","ContextMenu","hideContext","componentDidMount","setTimeout","global","addEventListener","componentWillUnmount","removeEventListener","stopPropagation","i","ContextMenuItem","onKeyDown","shiftKey","disabled","VISIBLE","VISIBILITY_CHANGE_EVENT","getFormattedMessage","message","getCollapsed","prefName","Disclaimer","onAcknowledge","disclaimerPref","disclaimer","text","href","button","DisclaimerIntl","_CollapsibleSection","onBodyMount","onHeaderClick","onTransitionEnd","enableOrDisableAnimation","onMenuButtonClick","onMenuButtonMouseEnter","onMenuButtonMouseLeave","onMenuUpdate","enableAnimation","isAnimating","menuButtonHover","showContextMenu","componentWillMount","document","componentWillUpdate","nextProps","sectionBody","scrollHeight","visibilityState","node","maxHeight","currentTarget","renderIcon","startsWith","backgroundImage","preventDefault","isCollapsible","isCollapsed","extraMenuOptions","showPrefName","privacyNoticeURL","isFirst","isLast","needsDisclaimer","active","CollapsibleSection","RECORDED_SECTIONS","ComponentPerfTimer","Component","perfSvc","_sendBadStateEvent","_sendPaintedEvent","_reportMissingData","_timestampHandled","_recordedFirstRender","_maybeSendPaintedEvent","componentDidUpdate","_afterFramePaint","callback","requestAnimationFrame","_maybeSendBadStateEvent","_ensureFirstRenderTsRecorded","mark","dataReadyKey","firstRenderKey","parseInt","getMostRecentAbsMarkStartByName","SAVE_SESSION_PERF_DATA","ex","ChromeUtils","import","usablePerfObj","Services","appShell","hiddenDOMWindow","performance","now","_PerfService","performanceObj","_perf","prototype","str","getEntriesByName","timeOrigin","absNow","entries","mostRecentEntry","startTime","TopSiteLink","onDragEvent","_allowDrop","e","dataTransfer","types","dragged","effectAllowed","setData","blur","isDraggable","topSiteOuterClassName","isDragged","tippyTopIcon","faviconSize","letterFallback","imageClassName","imageStyle","showSmallFavicon","smallFaviconStyle","smallFaviconFallback","backgroundColor","favicon","draggableProps","onDragEnd","onDragStart","onMouseDown","TopSite","onLinkClick","_getTelemetryInfo","icon_type","iconType","card_type","ev","onActivate","isContextMenuOpen","activeIndex","hostname","TopSitePlaceholder","onEditButtonClick","_TopSiteList","DEFAULT_STATE","draggedIndex","draggedSite","draggedTitle","topSitesPreview","componentWillReceiveProps","prevTopSites","newTopSites","dropped","_makeTopSitesPreview","TOP_SITES_INSERT","draggedFromIndex","_getTopSites","topSites","slice","TopSitesRows","pinnedOnly","unpinned","siteToInsert","holeIndex","indexStep","shiftingStep","nextIndex","preview","shift","topSitesUI","commonProps","maxNarrowVisibleIndex","l","topSiteIconType","slotProps","TopSiteList","store","initStore","gActivityStreamPrerenderedState","sendEventOrAddListener","NEW_TAB_STATE_REQUEST","ReactDOM","hydrate","documentElement","lang","gActivityStreamStrings","getElementById","addSnippetsSubscriber","DATABASE_NAME","DATABASE_VERSION","SNIPPETS_OBJECTSTORE_NAME","SNIPPETS_UPDATE_INTERVAL_MS","SNIPPETS_ENABLED_EVENT","SNIPPETS_DISABLED_EVENT","SnippetsMap","_db","_dispatch","_dbTransaction","db","put","delete","clear","get","blockSnippetById","SNIPPETS_BLOCKLIST_UPDATED","disableOnboarding","DISABLE_ONBOARDING","showFirefoxAccounts","SHOW_FIREFOX_ACCOUNTS","getTotalBookmarksCount","Promise","resolve","TOTAL_BOOKMARKS_REQUEST","addMessageListener","onMessage","TOTAL_BOOKMARKS_RESPONSE","removeMessageListener","_openDB","_restoreFromDb","modifier","reject","transaction","objectStore","onsuccess","onerror","openRequest","indexedDB","open","deleteDatabase","onupgradeneeded","objectStoreNames","contains","createObjectStore","err","console","onversionchange","versionChangeEvent","close","cursorRequest","openCursor","cursor","continue","SnippetsProvider","gSnippetsMap","_onAction","snippetsMap","_refreshSnippets","cachedVersion","appData","lastUpdate","needsUpdate","Date","snippetsURL","response","fetch","status","payload","_noSnippetFallback","_forceOnboardingVisibility","shouldBeVisible","onboardingEl","style","display","_showRemoteSnippets","snippetsEl","elementId","innerHTML","scriptEl","getElementsByTagName","relocatedScript","createElement","parentNode","replaceChild","msg","init","keys","dispatchEvent","Event","uninit","snippets","initializing","subscribe","disableSnippets","_handleCancelBtn","_handleConfirmBtn","_renderModalMessage","message_body","ConfirmDialog","onLaunchTour","onCancelTour","MIGRATION_START","MIGRATION_CANCEL","ManualMigration","PreferencesInput","onChange","labelClassName","titleString","descString","Children","child","handleClickOutside","handlePrefChange","handleSectionChange","togglePane","onWrapperMount","prevProps","isSidebarOpen","wrapper","checked","SECTION_ENABLE","SECTION_DISABLE","prefs","sections","isVisible","showSearch","showTopSites","topSitesRows","shouldHidePref","pref","feed","nestedPrefs","nestedPref","_PrerenderData","initialPrefs","initialSections","_setValidation","validation","_validation","invalidatingPrefs","_invalidatingPrefs","next","oneOf","arePrefsValid","getPref","some","order","provider","onInputMount","handleEvent","detail","gContentSearchController","search","input","healthReportKey","IS_NEWTAB","searchSource","ContentSearchUIController","Search","addLocaleDataForReactIntl","locale","addLocaleData","parentLocale","sendNewTabRehydrated","isPrerendered","PAGE_PRERENDERED","renderNotified","NEW_TAB_REHYDRATED","strings","shouldBeFixedToTop","PrerenderData","outerClassName","enableWideLayout","migrationExpired","Base","documentURI","CARDS_PER_ROW","Section","_dispatchImpressionStats","maxCards","maxRows","cards","needsImpressionStats","impressionCardGuids","sendImpressionStatsOrAddListener","_onVisibilityChange","isCollapsedPref","wasCollapsed","numberOfPlaceholders","items","remainder","emptyState","contextMenuOptions","shouldShowTopics","topics","realRows","placeholders","shouldShowEmptyState","padding","isWebExtension","_","read_more_endpoint","SectionIntl","_Sections","renderSections","enabledSections","sectionOrder","expectedCount","sectionId","split","cardContextTypes","history","intlID","bookmark","trending","gImageLoading","activeCard","imageLoaded","maybeLoadImage","image","loaderPromise","loader","Image","src","catch","then","altKey","ctrlKey","metaKey","OPEN_LINK","WEBEXT_CLICK","click","hasImage","placeholder","undefined","description","join","context","Card","PlaceholderCard","SectionMenuOptions","MoveUp","SECTION_MOVE","direction","MoveDown","RemoveSection","CollapseSection","collapsePrefName","ExpandSection","ManageSection","AddTopSite","PrivacyNotice","CheckCollapsed","DEFAULT_SECTION_MENU_OPTIONS","extraOptions","SectionMenu","Topic","Topics","t","faviconRef","countTopSitesIconsTypes","countTopSitesTypes","acc","_TopSites","onFormClose","_dispatchTopSitesStats","_getVisibleTopSites","topSitesIconsStats","topSitesPinned","topsites_icon_stats","topsites_pinned","sitesPerRow","matchMedia","matches","onMount","validationError","focus","showClearButton","onClear","typeUrl","titleId","placeholderId","errorMessageId","TopSiteFormInput","onLabelChange","onUrlChange","onCancelButtonClick","onClearUrlClick","onDoneButtonClick","onClose","validateForm","cleanUrl","validateUrl","URL","validate","showAsAdd","TopSiteForm","DetectUserSessionStart","_store","_perfService","perfService","_sendEvent","visibility_event_rcvd_ts","MERGE_STORE_ACTION","OUTGOING_MESSAGE_NAME","INCOMING_MESSAGE_NAME","EARLY_QUEUED_ACTIONS","mergeStateReducer","mainReducer","messageMiddleware","au","sendAsyncMessage","rehydrationMiddleware","_didRehydrate","isMergeStoreAction","isRehydrationRequest","_didRequestInitialState","queueEarlyMessageMiddleware","_receivedFromMain","_earlyActionQueue","reducers","initialState","createStore","combineReducers","applyMiddleware","dump","JSON","stringify","stack"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AC7DA;AAAA;;;AAGA;;wBAEyB,qB;2BACG,wB;2BACA,iC;cACb,C;yBACW,C;;AAE1B;;;;;;AAKA,MAAMA,sBAAsB,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,kBAAhC,GAAqDC,OAAjF;AAAA;AAAA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,EAApB;AAAA;AAAA;;AACA,KAAK,MAAMC,IAAX,IAAmB,CACjB,qBADiB,EAEjB,WAFiB,EAGjB,cAHiB,EAIjB,uBAJiB,EAKjB,oBALiB,EA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A5U,UAAM4U,iBAAN,CAAwB7rB,IAAxB,CAA6BlE,MAA7B;AACD,GAHM,MAGA;AACL;AACA6kB,SAAK7kB,MAAL;AACD;AACF,CAlBM;AAAA;AAAA;;AAoBP;;;;;;;AAOO,SAASob,SAAT,CAAmB4U,QAAnB,EAA6BC,YAA7B,EAA2C;AAChD,QAAM9U,QAAQ,0DAAA+U,CACZf,kBAAkB,8DAAAgB,CAAgBH,QAAhB,CAAlB,CADY,EAEZC,YAFY,EAGZ9f,OAAOqN,kBAAP,IAA6B,8DAAA4S,CAAgBZ,qBAAhB,EAAuCK,2BAAvC,EAAoER,iBAApE,CAHjB,CAAd;;AAMAlU,QAAMsU,aAAN,GAAsB,KAAtB;AACAtU,QAAMyU,uBAAN,GAAgC,KAAhC;;AAEA,MAAIzf,OAAOqN,kBAAX,EAA+B;AAC7BrN,WAAOqN,kBAAP,CAA0ByR,qBAA1B,EAAiD7N,OAAO;AACtD,UAAI;AACFjG,cAAM9L,QAAN,CAAe+R,IAAI3f,IAAnB;AACD,OAFD,CAEE,OAAO6T,EAAP,EAAW;AACXuJ,gBAAQ1T,KAAR,CAAc,cAAd,EAA8BiW,GAA9B,EAAmC,kBAAnC,EAAuD9L,EAAvD,EADW,CACiD;AAC5D+a,aAAM,gBAAeC,KAAKC,SAAL,CAAenP,GAAf,CAAoB,qBAAoB9L,EAAG,KAAIA,GAAGkb,KAAM,EAA7E;AACD;AACF,KAPD;AAQD;;AAED,SAAOrV,KAAP;AACD,C;;;;;;;AC1ID,uB;;;;;;ACAA,0B","file":"activity-stream.bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f840e51d38912f8e8968","/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\"use strict\";\n\nthis.MAIN_MESSAGE_TYPE = \"ActivityStream:Main\";\nthis.CONTENT_MESSAGE_TYPE = \"ActivityStream:Content\";\nthis.PRELOAD_MESSAGE_TYPE = \"ActivityStream:PreloadedBrowser\";\nthis.UI_CODE = 1;\nthis.BACKGROUND_PROCESS = 2;\n\n/**\n * globalImportContext - Are we in UI code (i.e. react, a dom) or some kind of background process?\n * Use this in action creators if you need different logic\n * for ui/background processes.\n */\nconst globalImportContext = typeof Window === \"undefined\" ? BACKGROUND_PROCESS : UI_CODE;\n// Export for tests\nthis.globalImportContext = globalImportContext;\n\n// Create an object that avoids accidental differing key/value pairs:\n// {\n// INIT: \"INIT\",\n// UNINIT: \"UNINIT\"\n// }\nconst actionTypes = {};\nfor (const type of [\n \"ARCHIVE_FROM_POCKET\",\n \"BLOCK_URL\",\n \"BOOKMARK_URL\",\n \"DELETE_BOOKMARK_BY_ID\",\n \"DELETE_FROM_POCKET\",\n \"DELETE_HISTORY_URL\",\n \"DELETE_HISTORY_URL_CONFIRM\",\n \"DIALOG_CANCEL\",\n \"DIALOG_OPEN\",\n \"DISABLE_ONBOARDING\",\n \"INIT\",\n \"MIGRATION_CANCEL\",\n \"MIGRATION_COMPLETED\",\n \"MIGRATION_START\",\n \"NEW_TAB_INIT\",\n \"NEW_TAB_INITIAL_STATE\",\n \"NEW_TAB_LOAD\",\n \"NEW_TAB_REHYDRATED\",\n \"NEW_TAB_STATE_REQUEST\",\n \"NEW_TAB_UNLOAD\",\n \"OPEN_LINK\",\n \"OPEN_NEW_WINDOW\",\n \"OPEN_PRIVATE_WINDOW\",\n \"PAGE_PRERENDERED\",\n \"PLACES_BOOKMARK_ADDED\",\n \"PLACES_BOOKMARK_CHANGED\",\n \"PLACES_BOOKMARK_REMOVED\",\n \"PLACES_HISTORY_CLEARED\",\n \"PLACES_LINKS_DELETED\",\n \"PLACES_LINK_BLOCKED\",\n \"PLACES_SAVED_TO_POCKET\",\n \"PREFS_INITIAL_VALUES\",\n \"PREF_CHANGED\",\n \"RICH_ICON_MISSING\",\n \"SAVE_SESSION_PERF_DATA\",\n \"SAVE_TO_POCKET\",\n \"SCREENSHOT_UPDATED\",\n \"SECTION_DEREGISTER\",\n \"SECTION_DISABLE\",\n \"SECTION_ENABLE\",\n \"SECTION_MOVE\",\n \"SECTION_OPTIONS_CHANGED\",\n \"SECTION_REGISTER\",\n \"SECTION_UPDATE\",\n \"SECTION_UPDATE_CARD\",\n \"SETTINGS_CLOSE\",\n \"SETTINGS_OPEN\",\n \"SET_PREF\",\n \"SHOW_FIREFOX_ACCOUNTS\",\n \"SNIPPETS_BLOCKLIST_CLEARED\",\n \"SNIPPETS_BLOCKLIST_UPDATED\",\n \"SNIPPETS_DATA\",\n \"SNIPPETS_RESET\",\n \"SNIPPET_BLOCKED\",\n \"SYSTEM_TICK\",\n \"TELEMETRY_IMPRESSION_STATS\",\n \"TELEMETRY_PERFORMANCE_EVENT\",\n \"TELEMETRY_UNDESIRED_EVENT\",\n \"TELEMETRY_USER_EVENT\",\n \"TOP_SITES_CANCEL_EDIT\",\n \"TOP_SITES_EDIT\",\n \"TOP_SITES_INSERT\",\n \"TOP_SITES_PIN\",\n \"TOP_SITES_UNPIN\",\n \"TOP_SITES_UPDATED\",\n \"TOTAL_BOOKMARKS_REQUEST\",\n \"TOTAL_BOOKMARKS_RESPONSE\",\n \"UNINIT\",\n \"WEBEXT_CLICK\",\n \"WEBEXT_DISMISS\"\n]) {\n actionTypes[type] = type;\n}\n\n// Helper function for creating routed actions between content and main\n// Not intended to be used by consumers\nfunction _RouteMessage(action, options) {\n const meta = action.meta ? Object.assign({}, action.meta) : {};\n if (!options || !options.from || !options.to) {\n throw new Error(\"Routed Messages must have options as the second parameter, and must at least include a .from and .to property.\");\n }\n // For each of these fields, if they are passed as an option,\n // add them to the action. If they are not defined, remove them.\n [\"from\", \"to\", \"toTarget\", \"fromTarget\", \"skipMain\", \"skipLocal\"].forEach(o => {\n if (typeof options[o] !== \"undefined\") {\n meta[o] = options[o];\n } else if (meta[o]) {\n delete meta[o];\n }\n });\n return Object.assign({}, action, {meta});\n}\n\n/**\n * AlsoToMain - Creates a message that will be dispatched locally and also sent to the Main process.\n *\n * @param {object} action Any redux action (required)\n * @param {object} options\n * @param {bool} skipLocal Used by OnlyToMain to skip the main reducer\n * @param {string} fromTarget The id of the content port from which the action originated. (optional)\n * @return {object} An action with added .meta properties\n */\nfunction AlsoToMain(action, fromTarget, skipLocal) {\n return _RouteMessage(action, {\n from: CONTENT_MESSAGE_TYPE,\n to: MAIN_MESSAGE_TYPE,\n fromTarget,\n skipLocal\n });\n}\n\n/**\n * OnlyToMain - Creates a message that will be sent to the Main process and skip the local reducer.\n *\n * @param {object} action Any redux action (required)\n * @param {object} options\n * @param {string} fromTarget The id of the content port from which the action originated. (optional)\n * @return {object} An action with added .meta properties\n */\nfunction OnlyToMain(action, fromTarget) {\n return AlsoToMain(action, fromTarget, true);\n}\n\n/**\n * BroadcastToContent - Creates a message that will be dispatched to main and sent to ALL content processes.\n *\n * @param {object} action Any redux action (required)\n * @return {object} An action with added .meta properties\n */\nfunction BroadcastToContent(action) {\n return _RouteMessage(action, {\n from: MAIN_MESSAGE_TYPE,\n to: CONTENT_MESSAGE_TYPE\n });\n}\n\n/**\n * AlsoToOneContent - Creates a message that will be will be dispatched to the main store\n * and also sent to a particular Content process.\n *\n * @param {object} action Any redux action (required)\n * @param {string} target The id of a content port\n * @param {bool} skipMain Used by OnlyToOneContent to skip the main process\n * @return {object} An action with added .meta properties\n */\nfunction AlsoToOneContent(action, target, skipMain) {\n if (!target) {\n throw new Error(\"You must provide a target ID as the second parameter of AlsoToOneContent. If you want to send to all content processes, use BroadcastToContent\");\n }\n return _RouteMessage(action, {\n from: MAIN_MESSAGE_TYPE,\n to: CONTENT_MESSAGE_TYPE,\n toTarget: target,\n skipMain\n });\n}\n\n/**\n * OnlyToOneContent - Creates a message that will be sent to a particular Content process\n * and skip the main reducer.\n *\n * @param {object} action Any redux action (required)\n * @param {string} target The id of a content port\n * @return {object} An action with added .meta properties\n */\nfunction OnlyToOneContent(action, target) {\n return AlsoToOneContent(action, target, true);\n}\n\n/**\n * AlsoToPreloaded - Creates a message that dispatched to the main reducer and also sent to the preloaded tab.\n *\n * @param {object} action Any redux action (required)\n * @return {object} An action with added .meta properties\n */\nfunction AlsoToPreloaded(action) {\n return _RouteMessage(action, {\n from: MAIN_MESSAGE_TYPE,\n to: PRELOAD_MESSAGE_TYPE\n });\n}\n\n/**\n * UserEvent - A telemetry ping indicating a user action. This should only\n * be sent from the UI during a user session.\n *\n * @param {object} data Fields to include in the ping (source, etc.)\n * @return {object} An AlsoToMain action\n */\nfunction UserEvent(data) {\n return AlsoToMain({\n type: actionTypes.TELEMETRY_USER_EVENT,\n data\n });\n}\n\n/**\n * UndesiredEvent - A telemetry ping indicating an undesired state.\n *\n * @param {object} data Fields to include in the ping (value, etc.)\n * @param {int} importContext (For testing) Override the import context for testing.\n * @return {object} An action. For UI code, a AlsoToMain action.\n */\nfunction UndesiredEvent(data, importContext = globalImportContext) {\n const action = {\n type: actionTypes.TELEMETRY_UNDESIRED_EVENT,\n data\n };\n return importContext === UI_CODE ? AlsoToMain(action) : action;\n}\n\n/**\n * PerfEvent - A telemetry ping indicating a performance-related event.\n *\n * @param {object} data Fields to include in the ping (value, etc.)\n * @param {int} importContext (For testing) Override the import context for testing.\n * @return {object} An action. For UI code, a AlsoToMain action.\n */\nfunction PerfEvent(data, importContext = globalImportContext) {\n const action = {\n type: actionTypes.TELEMETRY_PERFORMANCE_EVENT,\n data\n };\n return importContext === UI_CODE ? AlsoToMain(action) : action;\n}\n\n/**\n * ImpressionStats - A telemetry ping indicating an impression stats.\n *\n * @param {object} data Fields to include in the ping\n * @param {int} importContext (For testing) Override the import context for testing.\n * #return {object} An action. For UI code, a AlsoToMain action.\n */\nfunction ImpressionStats(data, importContext = globalImportContext) {\n const action = {\n type: actionTypes.TELEMETRY_IMPRESSION_STATS,\n data\n };\n return importContext === UI_CODE ? AlsoToMain(action) : action;\n}\n\nfunction SetPref(name, value, importContext = globalImportContext) {\n const action = {type: actionTypes.SET_PREF, data: {name, value}};\n return importContext === UI_CODE ? AlsoToMain(action) : action;\n}\n\nfunction WebExtEvent(type, data, importContext = globalImportContext) {\n if (!data || !data.source) {\n throw new Error(\"WebExtEvent actions should include a property \\\"source\\\", the id of the webextension that should receive the event.\");\n }\n const action = {type, data};\n return importContext === UI_CODE ? AlsoToMain(action) : action;\n}\n\nthis.actionTypes = actionTypes;\n\nthis.actionCreators = {\n BroadcastToContent,\n UserEvent,\n UndesiredEvent,\n PerfEvent,\n ImpressionStats,\n AlsoToOneContent,\n OnlyToOneContent,\n AlsoToMain,\n OnlyToMain,\n AlsoToPreloaded,\n SetPref,\n WebExtEvent\n};\n\n// These are helpers to test for certain kinds of actions\nthis.actionUtils = {\n isSendToMain(action) {\n if (!action.meta) {\n return false;\n }\n return action.meta.to === MAIN_MESSAGE_TYPE && action.meta.from === CONTENT_MESSAGE_TYPE;\n },\n isBroadcastToContent(action) {\n if (!action.meta) {\n return false;\n }\n if (action.meta.to === CONTENT_MESSAGE_TYPE && !action.meta.toTarget) {\n return true;\n }\n return false;\n },\n isSendToOneContent(action) {\n if (!action.meta) {\n return false;\n }\n if (action.meta.to === CONTENT_MESSAGE_TYPE && action.meta.toTarget) {\n return true;\n }\n return false;\n },\n isSendToPreloaded(action) {\n if (!action.meta) {\n return false;\n }\n return action.meta.to === PRELOAD_MESSAGE_TYPE &&\n action.meta.from === MAIN_MESSAGE_TYPE;\n },\n isFromMain(action) {\n if (!action.meta) {\n return false;\n }\n return action.meta.from === MAIN_MESSAGE_TYPE &&\n action.meta.to === CONTENT_MESSAGE_TYPE;\n },\n getPortIdOfSender(action) {\n return (action.meta && action.meta.fromTarget) || null;\n },\n _RouteMessage\n};\n\nconst EXPORTED_SYMBOLS = [\n \"actionTypes\",\n \"actionCreators\",\n \"actionUtils\",\n \"globalImportContext\",\n \"UI_CODE\",\n \"BACKGROUND_PROCESS\",\n \"MAIN_MESSAGE_TYPE\",\n \"CONTENT_MESSAGE_TYPE\",\n \"PRELOAD_MESSAGE_TYPE\"\n];\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/common/Actions.jsm","module.exports = React;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"React\"\n// module id = 1\n// module chunks = 0","module.exports = ReactIntl;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"ReactIntl\"\n// module id = 2\n// module chunks = 0","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0","module.exports = ReactRedux;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"ReactRedux\"\n// module id = 4\n// module chunks = 0","export const TOP_SITES_SOURCE = \"TOP_SITES\";\nexport const TOP_SITES_CONTEXT_MENU_OPTIONS = [\"CheckPinTopSite\", \"EditTopSite\", \"Separator\",\n \"OpenInNewWindow\", \"OpenInPrivateWindow\", \"Separator\", \"BlockUrl\", \"DeleteUrl\"];\n// minimum size necessary to show a rich icon instead of a screenshot\nexport const MIN_RICH_FAVICON_SIZE = 96;\n// minimum size necessary to show any icon in the top left corner with a screenshot\nexport const MIN_CORNER_FAVICON_SIZE = 16;\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/TopSites/TopSitesConstants.js","this.Dedupe = class Dedupe {\n constructor(createKey) {\n this.createKey = createKey || this.defaultCreateKey;\n }\n\n defaultCreateKey(item) {\n return item;\n }\n\n /**\n * Dedupe any number of grouped elements favoring those from earlier groups.\n *\n * @param {Array} groups Contains an arbitrary number of arrays of elements.\n * @returns {Array} A matching array of each provided group deduped.\n */\n group(...groups) {\n const globalKeys = new Set();\n const result = [];\n for (const values of groups) {\n const valueMap = new Map();\n for (const value of values) {\n const key = this.createKey(value);\n if (!globalKeys.has(key) && !valueMap.has(key)) {\n valueMap.set(key, value);\n }\n }\n result.push(valueMap);\n valueMap.forEach((value, key) => globalKeys.add(key));\n }\n return result.map(m => Array.from(m.values()));\n }\n};\n\nconst EXPORTED_SYMBOLS = [\"Dedupe\"];\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/common/Dedupe.jsm","/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\"use strict\";\n\nconst {actionTypes: at} = ChromeUtils.import(\"resource://activity-stream/common/Actions.jsm\", {});\nconst {Dedupe} = ChromeUtils.import(\"resource://activity-stream/common/Dedupe.jsm\", {});\n\nconst TOP_SITES_DEFAULT_ROWS = 1;\nconst TOP_SITES_MAX_SITES_PER_ROW = 8;\n\nconst dedupe = new Dedupe(site => site && site.url);\n\nconst INITIAL_STATE = {\n App: {\n // Have we received real data from the app yet?\n initialized: false,\n // The version of the system-addon\n version: null\n },\n Snippets: {initialized: false},\n TopSites: {\n // Have we received real data from history yet?\n initialized: false,\n // The history (and possibly default) links\n rows: [],\n // Used in content only to dispatch action to TopSiteForm.\n editForm: null\n },\n Prefs: {\n initialized: false,\n values: {}\n },\n Dialog: {\n visible: false,\n data: {}\n },\n Sections: [],\n PreferencesPane: {visible: false}\n};\n\nfunction App(prevState = INITIAL_STATE.App, action) {\n switch (action.type) {\n case at.INIT:\n return Object.assign({}, prevState, action.data || {}, {initialized: true});\n default:\n return prevState;\n }\n}\n\n/**\n * insertPinned - Inserts pinned links in their specified slots\n *\n * @param {array} a list of links\n * @param {array} a list of pinned links\n * @return {array} resulting list of links with pinned links inserted\n */\nfunction insertPinned(links, pinned) {\n // Remove any pinned links\n const pinnedUrls = pinned.map(link => link && link.url);\n let newLinks = links.filter(link => (link ? !pinnedUrls.includes(link.url) : false));\n newLinks = newLinks.map(link => {\n if (link && link.isPinned) {\n delete link.isPinned;\n delete link.pinIndex;\n }\n return link;\n });\n\n // Then insert them in their specified location\n pinned.forEach((val, index) => {\n if (!val) { return; }\n let link = Object.assign({}, val, {isPinned: true, pinIndex: index});\n if (index > newLinks.length) {\n newLinks[index] = link;\n } else {\n newLinks.splice(index, 0, link);\n }\n });\n\n return newLinks;\n}\n\nfunction TopSites(prevState = INITIAL_STATE.TopSites, action) {\n let hasMatch;\n let newRows;\n switch (action.type) {\n case at.TOP_SITES_UPDATED:\n if (!action.data) {\n return prevState;\n }\n return Object.assign({}, prevState, {initialized: true, rows: action.data});\n case at.TOP_SITES_EDIT:\n return Object.assign({}, prevState, {editForm: {index: action.data.index}});\n case at.TOP_SITES_CANCEL_EDIT:\n return Object.assign({}, prevState, {editForm: null});\n case at.SCREENSHOT_UPDATED:\n newRows = prevState.rows.map(row => {\n if (row && row.url === action.data.url) {\n hasMatch = true;\n return Object.assign({}, row, {screenshot: action.data.screenshot});\n }\n return row;\n });\n return hasMatch ? Object.assign({}, prevState, {rows: newRows}) : prevState;\n case at.PLACES_BOOKMARK_ADDED:\n if (!action.data) {\n return prevState;\n }\n newRows = prevState.rows.map(site => {\n if (site && site.url === action.data.url) {\n const {bookmarkGuid, bookmarkTitle, dateAdded} = action.data;\n return Object.assign({}, site, {bookmarkGuid, bookmarkTitle, bookmarkDateCreated: dateAdded});\n }\n return site;\n });\n return Object.assign({}, prevState, {rows: newRows});\n case at.PLACES_BOOKMARK_REMOVED:\n if (!action.data) {\n return prevState;\n }\n newRows = prevState.rows.map(site => {\n if (site && site.url === action.data.url) {\n const newSite = Object.assign({}, site);\n delete newSite.bookmarkGuid;\n delete newSite.bookmarkTitle;\n delete newSite.bookmarkDateCreated;\n return newSite;\n }\n return site;\n });\n return Object.assign({}, prevState, {rows: newRows});\n default:\n return prevState;\n }\n}\n\nfunction Dialog(prevState = INITIAL_STATE.Dialog, action) {\n switch (action.type) {\n case at.DIALOG_OPEN:\n return Object.assign({}, prevState, {visible: true, data: action.data});\n case at.DIALOG_CANCEL:\n return Object.assign({}, prevState, {visible: false});\n case at.DELETE_HISTORY_URL:\n return Object.assign({}, INITIAL_STATE.Dialog);\n default:\n return prevState;\n }\n}\n\nfunction Prefs(prevState = INITIAL_STATE.Prefs, action) {\n let newValues;\n switch (action.type) {\n case at.PREFS_INITIAL_VALUES:\n return Object.assign({}, prevState, {initialized: true, values: action.data});\n case at.PREF_CHANGED:\n newValues = Object.assign({}, prevState.values);\n newValues[action.data.name] = action.data.value;\n return Object.assign({}, prevState, {values: newValues});\n default:\n return prevState;\n }\n}\n\nfunction Sections(prevState = INITIAL_STATE.Sections, action) {\n let hasMatch;\n let newState;\n switch (action.type) {\n case at.SECTION_DEREGISTER:\n return prevState.filter(section => section.id !== action.data);\n case at.SECTION_REGISTER:\n // If section exists in prevState, update it\n newState = prevState.map(section => {\n if (section && section.id === action.data.id) {\n hasMatch = true;\n return Object.assign({}, section, action.data);\n }\n return section;\n });\n // Otherwise, append it\n if (!hasMatch) {\n const initialized = !!(action.data.rows && action.data.rows.length > 0);\n const section = Object.assign({title: \"\", rows: [], enabled: false}, action.data, {initialized});\n newState.push(section);\n }\n return newState;\n case at.SECTION_UPDATE:\n newState = prevState.map(section => {\n if (section && section.id === action.data.id) {\n // If the action is updating rows, we should consider initialized to be true.\n // This can be overridden if initialized is defined in the action.data\n const initialized = action.data.rows ? {initialized: true} : {};\n\n // Make sure pinned cards stay at their current position when rows are updated.\n // Disabling a section (SECTION_UPDATE with empty rows) does not retain pinned cards.\n if (action.data.rows && action.data.rows.length > 0 && section.rows.find(card => card.pinned)) {\n const rows = Array.from(action.data.rows);\n section.rows.forEach((card, index) => {\n if (card.pinned) {\n rows.splice(index, 0, card);\n }\n });\n return Object.assign({}, section, initialized, Object.assign({}, action.data, {rows}));\n }\n\n return Object.assign({}, section, initialized, action.data);\n }\n return section;\n });\n\n if (!action.data.dedupeConfigurations) {\n return newState;\n }\n\n action.data.dedupeConfigurations.forEach(dedupeConf => {\n newState = newState.map(section => {\n if (section.id === dedupeConf.id) {\n const dedupedRows = dedupeConf.dedupeFrom.reduce((rows, dedupeSectionId) => {\n const dedupeSection = newState.find(s => s.id === dedupeSectionId);\n const [, newRows] = dedupe.group(dedupeSection.rows, rows);\n return newRows;\n }, section.rows);\n\n return Object.assign({}, section, {rows: dedupedRows});\n }\n\n return section;\n });\n });\n\n return newState;\n case at.SECTION_UPDATE_CARD:\n return prevState.map(section => {\n if (section && section.id === action.data.id && section.rows) {\n const newRows = section.rows.map(card => {\n if (card.url === action.data.url) {\n return Object.assign({}, card, action.data.options);\n }\n return card;\n });\n return Object.assign({}, section, {rows: newRows});\n }\n return section;\n });\n case at.PLACES_BOOKMARK_ADDED:\n if (!action.data) {\n return prevState;\n }\n return prevState.map(section => Object.assign({}, section, {\n rows: section.rows.map(item => {\n // find the item within the rows that is attempted to be bookmarked\n if (item.url === action.data.url) {\n const {bookmarkGuid, bookmarkTitle, dateAdded} = action.data;\n return Object.assign({}, item, {\n bookmarkGuid,\n bookmarkTitle,\n bookmarkDateCreated: dateAdded,\n type: \"bookmark\"\n });\n }\n return item;\n })\n }));\n case at.PLACES_SAVED_TO_POCKET:\n if (!action.data) {\n return prevState;\n }\n return prevState.map(section => Object.assign({}, section, {\n rows: section.rows.map(item => {\n if (item.url === action.data.url) {\n return Object.assign({}, item, {\n open_url: action.data.open_url,\n pocket_id: action.data.pocket_id,\n title: action.data.title,\n type: \"pocket\"\n });\n }\n return item;\n })\n }));\n case at.PLACES_BOOKMARK_REMOVED:\n if (!action.data) {\n return prevState;\n }\n return prevState.map(section => Object.assign({}, section, {\n rows: section.rows.map(item => {\n // find the bookmark within the rows that is attempted to be removed\n if (item.url === action.data.url) {\n const newSite = Object.assign({}, item);\n delete newSite.bookmarkGuid;\n delete newSite.bookmarkTitle;\n delete newSite.bookmarkDateCreated;\n if (!newSite.type || newSite.type === \"bookmark\") {\n newSite.type = \"history\";\n }\n return newSite;\n }\n return item;\n })\n }));\n case at.PLACES_LINKS_DELETED:\n return prevState.map(section => Object.assign({}, section,\n {rows: section.rows.filter(site => !action.data.includes(site.url))}));\n case at.PLACES_LINK_BLOCKED:\n return prevState.map(section =>\n Object.assign({}, section, {rows: section.rows.filter(site => site.url !== action.data.url)}));\n case at.DELETE_FROM_POCKET:\n case at.ARCHIVE_FROM_POCKET:\n return prevState.map(section =>\n Object.assign({}, section, {rows: section.rows.filter(site => site.pocket_id !== action.data.pocket_id)}));\n default:\n return prevState;\n }\n}\n\nfunction Snippets(prevState = INITIAL_STATE.Snippets, action) {\n switch (action.type) {\n case at.SNIPPETS_DATA:\n return Object.assign({}, prevState, {initialized: true}, action.data);\n case at.SNIPPET_BLOCKED:\n return Object.assign({}, prevState, {blockList: prevState.blockList.concat(action.data)});\n case at.SNIPPETS_BLOCKLIST_CLEARED:\n return Object.assign({}, prevState, {blockList: []});\n case at.SNIPPETS_RESET:\n return INITIAL_STATE.Snippets;\n default:\n return prevState;\n }\n}\n\nfunction PreferencesPane(prevState = INITIAL_STATE.PreferencesPane, action) {\n switch (action.type) {\n case at.SETTINGS_OPEN:\n return Object.assign({}, prevState, {visible: true});\n case at.SETTINGS_CLOSE:\n return Object.assign({}, prevState, {visible: false});\n default:\n return prevState;\n }\n}\n\nthis.INITIAL_STATE = INITIAL_STATE;\nthis.TOP_SITES_DEFAULT_ROWS = TOP_SITES_DEFAULT_ROWS;\nthis.TOP_SITES_MAX_SITES_PER_ROW = TOP_SITES_MAX_SITES_PER_ROW;\n\nthis.reducers = {TopSites, App, Snippets, Prefs, Dialog, Sections, PreferencesPane};\n\nconst EXPORTED_SYMBOLS = [\"reducers\", \"INITIAL_STATE\", \"insertPinned\", \"TOP_SITES_DEFAULT_ROWS\", \"TOP_SITES_MAX_SITES_PER_ROW\"];\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/common/Reducers.jsm","import {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\n\nexport class ErrorBoundaryFallback extends React.PureComponent {\n constructor(props) {\n super(props);\n this.windowObj = this.props.windowObj || window;\n this.onClick = this.onClick.bind(this);\n }\n\n /**\n * Since we only get here if part of the page has crashed, do a\n * forced reload to give us the best chance at recovering.\n */\n onClick() {\n this.windowObj.location.reload(true);\n }\n\n render() {\n const defaultClass = \"as-error-fallback\";\n let className;\n if (\"className\" in this.props) {\n className = `${this.props.className} ${defaultClass}`;\n } else {\n className = defaultClass;\n }\n\n // href=\"#\" to force normal link styling stuff (eg cursor on hover)\n return (\n <div className={className}>\n <div>\n <FormattedMessage\n defaultMessage=\"Oops, something went wrong loading this content.\"\n id=\"error_fallback_default_info\" />\n </div>\n <span>\n <a href=\"#\" className=\"reload-button\" onClick={this.onClick}>\n <FormattedMessage\n defaultMessage=\"Refresh page to try again.\"\n id=\"error_fallback_default_refresh_suggestion\" />\n </a>\n </span>\n </div>\n );\n }\n}\nErrorBoundaryFallback.defaultProps = {className: \"as-error-fallback\"};\n\nexport class ErrorBoundary extends React.PureComponent {\n constructor(props) {\n super(props);\n this.state = {hasError: false};\n }\n\n componentDidCatch(error, info) {\n this.setState({hasError: true});\n }\n\n render() {\n if (!this.state.hasError) {\n return (this.props.children);\n }\n\n return <this.props.FallbackComponent className={this.props.className} />;\n }\n}\n\nErrorBoundary.defaultProps = {FallbackComponent: ErrorBoundaryFallback};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/ErrorBoundary/ErrorBoundary.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\n\nconst _OpenInPrivateWindow = site => ({\n id: \"menu_action_open_private_window\",\n icon: \"new-window-private\",\n action: ac.OnlyToMain({\n type: at.OPEN_PRIVATE_WINDOW,\n data: {url: site.url, referrer: site.referrer}\n }),\n userEvent: \"OPEN_PRIVATE_WINDOW\"\n});\n\n/**\n * List of functions that return items that can be included as menu options in a\n * LinkMenu. All functions take the site as the first parameter, and optionally\n * the index of the site.\n */\nexport const LinkMenuOptions = {\n Separator: () => ({type: \"separator\"}),\n EmptyItem: () => ({type: \"empty\"}),\n RemoveBookmark: site => ({\n id: \"menu_action_remove_bookmark\",\n icon: \"bookmark-added\",\n action: ac.AlsoToMain({\n type: at.DELETE_BOOKMARK_BY_ID,\n data: site.bookmarkGuid\n }),\n userEvent: \"BOOKMARK_DELETE\"\n }),\n AddBookmark: site => ({\n id: \"menu_action_bookmark\",\n icon: \"bookmark-hollow\",\n action: ac.AlsoToMain({\n type: at.BOOKMARK_URL,\n data: {url: site.url, title: site.title, type: site.type}\n }),\n userEvent: \"BOOKMARK_ADD\"\n }),\n OpenInNewWindow: site => ({\n id: \"menu_action_open_new_window\",\n icon: \"new-window\",\n action: ac.AlsoToMain({\n type: at.OPEN_NEW_WINDOW,\n data: {url: site.url, referrer: site.referrer}\n }),\n userEvent: \"OPEN_NEW_WINDOW\"\n }),\n BlockUrl: (site, index, eventSource) => ({\n id: \"menu_action_dismiss\",\n icon: \"dismiss\",\n action: ac.AlsoToMain({\n type: at.BLOCK_URL,\n data: {url: site.url, pocket_id: site.pocket_id}\n }),\n impression: ac.ImpressionStats({\n source: eventSource,\n block: 0,\n tiles: [{id: site.guid, pos: index}]\n }),\n userEvent: \"BLOCK\"\n }),\n\n // This is an option for web extentions which will result in remove items from\n // memory and notify the web extenion, rather than using the built-in block list.\n WebExtDismiss: (site, index, eventSource) => ({\n id: \"menu_action_webext_dismiss\",\n string_id: \"menu_action_dismiss\",\n icon: \"dismiss\",\n action: ac.WebExtEvent(at.WEBEXT_DISMISS, {\n source: eventSource,\n url: site.url,\n action_position: index\n })\n }),\n DeleteUrl: (site, index, eventSource, isEnabled, siteInfo) => ({\n id: \"menu_action_delete\",\n icon: \"delete\",\n action: {\n type: at.DIALOG_OPEN,\n data: {\n onConfirm: [\n ac.AlsoToMain({type: at.DELETE_HISTORY_URL, data: {url: site.url, pocket_id: site.pocket_id, forceBlock: site.bookmarkGuid}}),\n ac.UserEvent(Object.assign({event: \"DELETE\", source: eventSource, action_position: index}, siteInfo))\n ],\n eventSource,\n body_string_id: [\"confirm_history_delete_p1\", \"confirm_history_delete_notice_p2\"],\n confirm_button_string_id: \"menu_action_delete\",\n cancel_button_string_id: \"topsites_form_cancel_button\",\n icon: \"modal-delete\"\n }\n },\n userEvent: \"DIALOG_OPEN\"\n }),\n PinTopSite: (site, index) => ({\n id: \"menu_action_pin\",\n icon: \"pin\",\n action: ac.AlsoToMain({\n type: at.TOP_SITES_PIN,\n data: {site: {url: site.url}, index}\n }),\n userEvent: \"PIN\"\n }),\n UnpinTopSite: site => ({\n id: \"menu_action_unpin\",\n icon: \"unpin\",\n action: ac.AlsoToMain({\n type: at.TOP_SITES_UNPIN,\n data: {site: {url: site.url}}\n }),\n userEvent: \"UNPIN\"\n }),\n SaveToPocket: (site, index, eventSource) => ({\n id: \"menu_action_save_to_pocket\",\n icon: \"pocket\",\n action: ac.AlsoToMain({\n type: at.SAVE_TO_POCKET,\n data: {site: {url: site.url, title: site.title}}\n }),\n impression: ac.ImpressionStats({\n source: eventSource,\n pocket: 0,\n tiles: [{id: site.guid, pos: index}]\n }),\n userEvent: \"SAVE_TO_POCKET\"\n }),\n DeleteFromPocket: site => ({\n id: \"menu_action_delete_pocket\",\n icon: \"delete\",\n action: ac.AlsoToMain({\n type: at.DELETE_FROM_POCKET,\n data: {pocket_id: site.pocket_id}\n }),\n userEvent: \"DELETE_FROM_POCKET\"\n }),\n ArchiveFromPocket: site => ({\n id: \"menu_action_archive_pocket\",\n icon: \"check\",\n action: ac.AlsoToMain({\n type: at.ARCHIVE_FROM_POCKET,\n data: {pocket_id: site.pocket_id}\n }),\n userEvent: \"ARCHIVE_FROM_POCKET\"\n }),\n EditTopSite: (site, index) => ({\n id: \"edit_topsites_button_text\",\n icon: \"edit\",\n action: {\n type: at.TOP_SITES_EDIT,\n data: {index}\n }\n }),\n CheckBookmark: site => (site.bookmarkGuid ? LinkMenuOptions.RemoveBookmark(site) : LinkMenuOptions.AddBookmark(site)),\n CheckPinTopSite: (site, index) => (site.isPinned ? LinkMenuOptions.UnpinTopSite(site) : LinkMenuOptions.PinTopSite(site, index)),\n CheckSavedToPocket: (site, index) => (site.pocket_id ? LinkMenuOptions.DeleteFromPocket(site) : LinkMenuOptions.SaveToPocket(site, index)),\n CheckBookmarkOrArchive: site => (site.pocket_id ? LinkMenuOptions.ArchiveFromPocket(site) : LinkMenuOptions.CheckBookmark(site)),\n CheckDeleteHistoryOrEmpty: (site, index, eventSource, isEnabled, siteInfo) => (site.pocket_id ? LinkMenuOptions.EmptyItem() : LinkMenuOptions.DeleteUrl(site, index, eventSource, isEnabled, siteInfo)),\n OpenInPrivateWindow: (site, index, eventSource, isEnabled) => (isEnabled ? _OpenInPrivateWindow(site) : LinkMenuOptions.EmptyItem())\n};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/link-menu-options.js","import {actionCreators as ac} from \"common/Actions.jsm\";\nimport {connect} from \"react-redux\";\nimport {ContextMenu} from \"content-src/components/ContextMenu/ContextMenu\";\nimport {injectIntl} from \"react-intl\";\nimport {LinkMenuOptions} from \"content-src/lib/link-menu-options\";\nimport React from \"react\";\n\nconst DEFAULT_SITE_MENU_OPTIONS = [\"CheckPinTopSite\", \"EditTopSite\", \"Separator\", \"OpenInNewWindow\", \"OpenInPrivateWindow\", \"Separator\", \"BlockUrl\"];\n\nexport class _LinkMenu extends React.PureComponent {\n getOptions() {\n const {props} = this;\n const {site, index, source, isPrivateBrowsingEnabled, siteInfo} = props;\n\n // Handle special case of default site\n const propOptions = !site.isDefault ? props.options : DEFAULT_SITE_MENU_OPTIONS;\n\n const options = propOptions.map(o => LinkMenuOptions[o](site, index, source, isPrivateBrowsingEnabled, siteInfo)).map(option => {\n const {action, impression, id, string_id, type, userEvent} = option;\n if (!type && id) {\n option.label = props.intl.formatMessage({id: string_id || id});\n option.onClick = () => {\n props.dispatch(action);\n if (userEvent) {\n const userEventData = Object.assign({\n event: userEvent,\n source,\n action_position: index\n }, siteInfo);\n props.dispatch(ac.UserEvent(userEventData));\n }\n if (impression && props.shouldSendImpressionStats) {\n props.dispatch(impression);\n }\n };\n }\n return option;\n });\n\n // This is for accessibility to support making each item tabbable.\n // We want to know which item is the first and which item\n // is the last, so we can close the context menu accordingly.\n options[0].first = true;\n options[options.length - 1].last = true;\n return options;\n }\n\n render() {\n return (<ContextMenu\n onUpdate={this.props.onUpdate}\n options={this.getOptions()} />);\n }\n}\n\nconst getState = state => ({isPrivateBrowsingEnabled: state.Prefs.values.isPrivateBrowsingEnabled});\nexport const LinkMenu = connect(getState)(injectIntl(_LinkMenu));\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/LinkMenu/LinkMenu.jsx","import React from \"react\";\n\nexport class ContextMenu extends React.PureComponent {\n constructor(props) {\n super(props);\n this.hideContext = this.hideContext.bind(this);\n this.onClick = this.onClick.bind(this);\n }\n\n hideContext() {\n this.props.onUpdate(false);\n }\n\n componentDidMount() {\n setTimeout(() => {\n global.addEventListener(\"click\", this.hideContext);\n }, 0);\n }\n\n componentWillUnmount() {\n global.removeEventListener(\"click\", this.hideContext);\n }\n\n onClick(event) {\n // Eat all clicks on the context menu so they don't bubble up to window.\n // This prevents the context menu from closing when clicking disabled items\n // or the separators.\n event.stopPropagation();\n }\n\n render() {\n return (<span className=\"context-menu\" onClick={this.onClick}>\n <ul role=\"menu\" className=\"context-menu-list\">\n {this.props.options.map((option, i) => (option.type === \"separator\" ?\n (<li key={i} className=\"separator\" />) :\n (option.type !== \"empty\" && <ContextMenuItem key={i} option={option} hideContext={this.hideContext} />)\n ))}\n </ul>\n </span>);\n }\n}\n\nexport class ContextMenuItem extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onClick = this.onClick.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n }\n\n onClick() {\n this.props.hideContext();\n this.props.option.onClick();\n }\n\n onKeyDown(event) {\n const {option} = this.props;\n switch (event.key) {\n case \"Tab\":\n // tab goes down in context menu, shift + tab goes up in context menu\n // if we're on the last item, one more tab will close the context menu\n // similarly, if we're on the first item, one more shift + tab will close it\n if ((event.shiftKey && option.first) || (!event.shiftKey && option.last)) {\n this.props.hideContext();\n }\n break;\n case \"Enter\":\n this.props.hideContext();\n option.onClick();\n break;\n }\n }\n\n render() {\n const {option} = this.props;\n return (\n <li role=\"menuitem\" className=\"context-menu-item\">\n <a onClick={this.onClick} onKeyDown={this.onKeyDown} tabIndex=\"0\" className={option.disabled ? \"disabled\" : \"\"}>\n {option.icon && <span className={`icon icon-spacer icon-${option.icon}`} />}\n {option.label}\n </a>\n </li>);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/ContextMenu/ContextMenu.jsx","import {FormattedMessage, injectIntl} from \"react-intl\";\nimport {actionCreators as ac} from \"common/Actions.jsm\";\nimport {ErrorBoundary} from \"content-src/components/ErrorBoundary/ErrorBoundary\";\nimport React from \"react\";\nimport {SectionMenu} from \"content-src/components/SectionMenu/SectionMenu\";\n\nconst VISIBLE = \"visible\";\nconst VISIBILITY_CHANGE_EVENT = \"visibilitychange\";\n\nfunction getFormattedMessage(message) {\n return typeof message === \"string\" ? <span>{message}</span> : <FormattedMessage {...message} />;\n}\nfunction getCollapsed(props) {\n return (props.prefName in props.Prefs.values) ? props.Prefs.values[props.prefName] : false;\n}\n\nexport class Disclaimer extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onAcknowledge = this.onAcknowledge.bind(this);\n }\n\n onAcknowledge() {\n this.props.dispatch(ac.SetPref(this.props.disclaimerPref, false));\n this.props.dispatch(ac.UserEvent({event: \"SECTION_DISCLAIMER_ACKNOWLEDGED\", source: this.props.eventSource}));\n }\n\n render() {\n const {disclaimer} = this.props;\n return (\n <div className=\"section-disclaimer\">\n <div className=\"section-disclaimer-text\">\n {getFormattedMessage(disclaimer.text)}\n {disclaimer.link &&\n <a href={disclaimer.link.href} target=\"_blank\" rel=\"noopener noreferrer\">\n {getFormattedMessage(disclaimer.link.title || disclaimer.link)}\n </a>\n }\n </div>\n\n <button onClick={this.onAcknowledge}>\n {getFormattedMessage(disclaimer.button)}\n </button>\n </div>\n );\n }\n}\n\nexport const DisclaimerIntl = injectIntl(Disclaimer);\n\nexport class _CollapsibleSection extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onBodyMount = this.onBodyMount.bind(this);\n this.onHeaderClick = this.onHeaderClick.bind(this);\n this.onTransitionEnd = this.onTransitionEnd.bind(this);\n this.enableOrDisableAnimation = this.enableOrDisableAnimation.bind(this);\n this.onMenuButtonClick = this.onMenuButtonClick.bind(this);\n this.onMenuButtonMouseEnter = this.onMenuButtonMouseEnter.bind(this);\n this.onMenuButtonMouseLeave = this.onMenuButtonMouseLeave.bind(this);\n this.onMenuUpdate = this.onMenuUpdate.bind(this);\n this.state = {enableAnimation: true, isAnimating: false, menuButtonHover: false, showContextMenu: false};\n }\n\n componentWillMount() {\n this.props.document.addEventListener(VISIBILITY_CHANGE_EVENT, this.enableOrDisableAnimation);\n }\n\n componentWillUpdate(nextProps) {\n // Check if we're about to go from expanded to collapsed\n if (!getCollapsed(this.props) && getCollapsed(nextProps)) {\n // This next line forces a layout flush of the section body, which has a\n // max-height style set, so that the upcoming collapse animation can\n // animate from that height to the collapsed height. Without this, the\n // update is coalesced and there's no animation from no-max-height to 0.\n this.sectionBody.scrollHeight; // eslint-disable-line no-unused-expressions\n }\n }\n\n componentWillUnmount() {\n this.props.document.removeEventListener(VISIBILITY_CHANGE_EVENT, this.enableOrDisableAnimation);\n }\n\n enableOrDisableAnimation() {\n // Only animate the collapse/expand for visible tabs.\n const visible = this.props.document.visibilityState === VISIBLE;\n if (this.state.enableAnimation !== visible) {\n this.setState({enableAnimation: visible});\n }\n }\n\n onBodyMount(node) {\n this.sectionBody = node;\n }\n\n onHeaderClick() {\n // If this.sectionBody is unset, it means that we're in some sort of error\n // state, probably displaying the error fallback, so we won't be able to\n // compute the height, and we don't want to persist the preference.\n if (!this.sectionBody) {\n return;\n }\n\n // Get the current height of the body so max-height transitions can work\n this.setState({\n isAnimating: true,\n maxHeight: `${this.sectionBody.scrollHeight}px`\n });\n this.props.dispatch(ac.SetPref(this.props.prefName, !getCollapsed(this.props)));\n }\n\n onTransitionEnd(event) {\n // Only update the animating state for our own transition (not a child's)\n if (event.target === event.currentTarget) {\n this.setState({isAnimating: false});\n }\n }\n\n renderIcon() {\n const {icon} = this.props;\n if (icon && icon.startsWith(\"moz-extension://\")) {\n return <span className=\"icon icon-small-spacer\" style={{backgroundImage: `url('${icon}')`}} />;\n }\n return <span className={`icon icon-small-spacer icon-${icon || \"webextension\"}`} />;\n }\n\n onMenuButtonClick(event) {\n event.preventDefault();\n this.setState({showContextMenu: true});\n }\n\n onMenuButtonMouseEnter() {\n this.setState({menuButtonHover: true});\n }\n\n onMenuButtonMouseLeave() {\n this.setState({menuButtonHover: false});\n }\n\n onMenuUpdate(showContextMenu) {\n this.setState({showContextMenu});\n }\n\n render() {\n const isCollapsible = this.props.prefName in this.props.Prefs.values;\n const isCollapsed = getCollapsed(this.props);\n const {enableAnimation, isAnimating, maxHeight, menuButtonHover, showContextMenu} = this.state;\n const {id, eventSource, disclaimer, title, extraMenuOptions, prefName, showPrefName, privacyNoticeURL, dispatch, isFirst, isLast} = this.props;\n const disclaimerPref = `section.${id}.showDisclaimer`;\n const needsDisclaimer = disclaimer && this.props.Prefs.values[disclaimerPref];\n const active = menuButtonHover || showContextMenu;\n\n return (\n <section className={`collapsible-section ${this.props.className}${enableAnimation ? \" animation-enabled\" : \"\"}${isCollapsed ? \" collapsed\" : \"\"}${active ? \" active\" : \"\"}`}>\n <div className=\"section-top-bar\">\n <h3 className=\"section-title\">\n <span className=\"click-target\" onClick={isCollapsible && this.onHeaderClick}>\n {this.renderIcon()}\n {title}\n {isCollapsible && <span className={`collapsible-arrow icon ${isCollapsed ? \"icon-arrowhead-forward-small\" : \"icon-arrowhead-down-small\"}`} />}\n </span>\n </h3>\n <div>\n <button\n className=\"context-menu-button icon\"\n onClick={this.onMenuButtonClick}\n onMouseEnter={this.onMenuButtonMouseEnter}\n onMouseLeave={this.onMenuButtonMouseLeave}>\n <span className=\"sr-only\">\n <FormattedMessage id=\"section_context_menu_button_sr\" />\n </span>\n </button>\n {showContextMenu &&\n <SectionMenu\n id={id}\n extraOptions={extraMenuOptions}\n eventSource={eventSource}\n showPrefName={showPrefName}\n collapsePrefName={prefName}\n privacyNoticeURL={privacyNoticeURL}\n isCollapsed={isCollapsed}\n onUpdate={this.onMenuUpdate}\n isFirst={isFirst}\n isLast={isLast}\n dispatch={dispatch} />\n }\n </div>\n </div>\n <ErrorBoundary className=\"section-body-fallback\">\n <div\n className={`section-body${isAnimating ? \" animating\" : \"\"}`}\n onTransitionEnd={this.onTransitionEnd}\n ref={this.onBodyMount}\n style={isAnimating && !isCollapsed ? {maxHeight} : null}>\n {needsDisclaimer && <DisclaimerIntl disclaimerPref={disclaimerPref} disclaimer={disclaimer} eventSource={eventSource} dispatch={this.props.dispatch} />}\n {this.props.children}\n </div>\n </ErrorBoundary>\n </section>\n );\n }\n}\n\n_CollapsibleSection.defaultProps = {\n document: global.document || {\n addEventListener: () => {},\n removeEventListener: () => {},\n visibilityState: \"hidden\"\n },\n Prefs: {values: {}}\n};\n\nexport const CollapsibleSection = injectIntl(_CollapsibleSection);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/CollapsibleSection/CollapsibleSection.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {perfService as perfSvc} from \"common/PerfService.jsm\";\nimport React from \"react\";\n\n// Currently record only a fixed set of sections. This will prevent data\n// from custom sections from showing up or from topstories.\nconst RECORDED_SECTIONS = [\"highlights\", \"topsites\"];\n\nexport class ComponentPerfTimer extends React.Component {\n constructor(props) {\n super(props);\n // Just for test dependency injection:\n this.perfSvc = this.props.perfSvc || perfSvc;\n\n this._sendBadStateEvent = this._sendBadStateEvent.bind(this);\n this._sendPaintedEvent = this._sendPaintedEvent.bind(this);\n this._reportMissingData = false;\n this._timestampHandled = false;\n this._recordedFirstRender = false;\n }\n\n componentDidMount() {\n if (!RECORDED_SECTIONS.includes(this.props.id)) {\n return;\n }\n\n this._maybeSendPaintedEvent();\n }\n\n componentDidUpdate() {\n if (!RECORDED_SECTIONS.includes(this.props.id)) {\n return;\n }\n\n this._maybeSendPaintedEvent();\n }\n\n /**\n * Call the given callback after the upcoming frame paints.\n *\n * @note Both setTimeout and requestAnimationFrame are throttled when the page\n * is hidden, so this callback may get called up to a second or so after the\n * requestAnimationFrame \"paint\" for hidden tabs.\n *\n * Newtabs hidden while loading will presumably be fairly rare (other than\n * preloaded tabs, which we will be filtering out on the server side), so such\n * cases should get lost in the noise.\n *\n * If we decide that it's important to find out when something that's hidden\n * has \"painted\", however, another option is to post a message to this window.\n * That should happen even faster than setTimeout, and, at least as of this\n * writing, it's not throttled in hidden windows in Firefox.\n *\n * @param {Function} callback\n *\n * @returns void\n */\n _afterFramePaint(callback) {\n requestAnimationFrame(() => setTimeout(callback, 0));\n }\n\n _maybeSendBadStateEvent() {\n // Follow up bugs:\n // https://github.com/mozilla/activity-stream/issues/3691\n if (!this.props.initialized) {\n // Remember to report back when data is available.\n this._reportMissingData = true;\n } else if (this._reportMissingData) {\n this._reportMissingData = false;\n // Report how long it took for component to become initialized.\n this._sendBadStateEvent();\n }\n }\n\n _maybeSendPaintedEvent() {\n // If we've already handled a timestamp, don't do it again.\n if (this._timestampHandled || !this.props.initialized) {\n return;\n }\n\n // And if we haven't, we're doing so now, so remember that. Even if\n // something goes wrong in the callback, we can't try again, as we'd be\n // sending back the wrong data, and we have to do it here, so that other\n // calls to this method while waiting for the next frame won't also try to\n // handle it.\n this._timestampHandled = true;\n this._afterFramePaint(this._sendPaintedEvent);\n }\n\n /**\n * Triggered by call to render. Only first call goes through due to\n * `_recordedFirstRender`.\n */\n _ensureFirstRenderTsRecorded() {\n // Used as t0 for recording how long component took to initialize.\n if (!this._recordedFirstRender) {\n this._recordedFirstRender = true;\n // topsites_first_render_ts, highlights_first_render_ts.\n const key = `${this.props.id}_first_render_ts`;\n this.perfSvc.mark(key);\n }\n }\n\n /**\n * Creates `TELEMETRY_UNDESIRED_EVENT` with timestamp in ms\n * of how much longer the data took to be ready for display than it would\n * have been the ideal case.\n * https://github.com/mozilla/ping-centre/issues/98\n */\n _sendBadStateEvent() {\n // highlights_data_ready_ts, topsites_data_ready_ts.\n const dataReadyKey = `${this.props.id}_data_ready_ts`;\n this.perfSvc.mark(dataReadyKey);\n\n try {\n const firstRenderKey = `${this.props.id}_first_render_ts`;\n // value has to be Int32.\n const value = parseInt(this.perfSvc.getMostRecentAbsMarkStartByName(dataReadyKey) -\n this.perfSvc.getMostRecentAbsMarkStartByName(firstRenderKey), 10);\n this.props.dispatch(ac.OnlyToMain({\n type: at.SAVE_SESSION_PERF_DATA,\n // highlights_data_late_by_ms, topsites_data_late_by_ms.\n data: {[`${this.props.id}_data_late_by_ms`]: value}\n }));\n } catch (ex) {\n // If this failed, it's likely because the `privacy.resistFingerprinting`\n // pref is true.\n }\n }\n\n _sendPaintedEvent() {\n // Record first_painted event but only send if topsites.\n if (this.props.id !== \"topsites\") {\n return;\n }\n\n // topsites_first_painted_ts.\n const key = `${this.props.id}_first_painted_ts`;\n this.perfSvc.mark(key);\n\n try {\n const data = {};\n data[key] = this.perfSvc.getMostRecentAbsMarkStartByName(key);\n\n this.props.dispatch(ac.OnlyToMain({\n type: at.SAVE_SESSION_PERF_DATA,\n data\n }));\n } catch (ex) {\n // If this failed, it's likely because the `privacy.resistFingerprinting`\n // pref is true. We should at least not blow up, and should continue\n // to set this._timestampHandled to avoid going through this again.\n }\n }\n\n render() {\n if (RECORDED_SECTIONS.includes(this.props.id)) {\n this._ensureFirstRenderTsRecorded();\n this._maybeSendBadStateEvent();\n }\n return this.props.children;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/ComponentPerfTimer/ComponentPerfTimer.jsx","/* globals Services */\n\"use strict\";\n\n/* istanbul ignore if */\nif (typeof ChromeUtils !== \"undefined\") {\n ChromeUtils.import(\"resource://gre/modules/Services.jsm\");\n}\n\nlet usablePerfObj;\n\n/* istanbul ignore if */\n/* istanbul ignore else */\nif (typeof Services !== \"undefined\") {\n // Borrow the high-resolution timer from the hidden window....\n usablePerfObj = Services.appShell.hiddenDOMWindow.performance;\n} else if (typeof performance !== \"undefined\") {\n // we must be running in content space\n // eslint-disable-next-line no-undef\n usablePerfObj = performance;\n} else {\n // This is a dummy object so this file doesn't crash in the node prerendering\n // task.\n usablePerfObj = {\n now() {},\n mark() {}\n };\n}\n\nfunction _PerfService(options) {\n // For testing, so that we can use a fake Window.performance object with\n // known state.\n if (options && options.performanceObj) {\n this._perf = options.performanceObj;\n } else {\n this._perf = usablePerfObj;\n }\n}\n\n_PerfService.prototype = {\n /**\n * Calls the underlying mark() method on the appropriate Window.performance\n * object to add a mark with the given name to the appropriate performance\n * timeline.\n *\n * @param {String} name the name to give the current mark\n * @return {void}\n */\n mark: function mark(str) {\n this._perf.mark(str);\n },\n\n /**\n * Calls the underlying getEntriesByName on the appropriate Window.performance\n * object.\n *\n * @param {String} name\n * @param {String} type eg \"mark\"\n * @return {Array} Performance* objects\n */\n getEntriesByName: function getEntriesByName(name, type) {\n return this._perf.getEntriesByName(name, type);\n },\n\n /**\n * The timeOrigin property from the appropriate performance object.\n * Used to ensure that timestamps from the add-on code and the content code\n * are comparable.\n *\n * @note If this is called from a context without a window\n * (eg a JSM in chrome), it will return the timeOrigin of the XUL hidden\n * window, which appears to be the first created window (and thus\n * timeOrigin) in the browser. Note also, however, there is also a private\n * hidden window, presumably for private browsing, which appears to be\n * created dynamically later. Exactly how/when that shows up needs to be\n * investigated.\n *\n * @return {Number} A double of milliseconds with a precision of 0.5us.\n */\n get timeOrigin() {\n return this._perf.timeOrigin;\n },\n\n /**\n * Returns the \"absolute\" version of performance.now(), i.e. one that\n * should ([bug 1401406](https://bugzilla.mozilla.org/show_bug.cgi?id=1401406)\n * be comparable across both chrome and content.\n *\n * @return {Number}\n */\n absNow: function absNow() {\n return this.timeOrigin + this._perf.now();\n },\n\n /**\n * This returns the absolute startTime from the most recent performance.mark()\n * with the given name.\n *\n * @param {String} name the name to lookup the start time for\n *\n * @return {Number} the returned start time, as a DOMHighResTimeStamp\n *\n * @throws {Error} \"No Marks with the name ...\" if none are available\n *\n * @note Always surround calls to this by try/catch. Otherwise your code\n * may fail when the `privacy.resistFingerprinting` pref is true. When\n * this pref is set, all attempts to get marks will likely fail, which will\n * cause this method to throw.\n *\n * See [bug 1369303](https://bugzilla.mozilla.org/show_bug.cgi?id=1369303)\n * for more info.\n */\n getMostRecentAbsMarkStartByName(name) {\n let entries = this.getEntriesByName(name, \"mark\");\n\n if (!entries.length) {\n throw new Error(`No marks with the name ${name}`);\n }\n\n let mostRecentEntry = entries[entries.length - 1];\n return this._perf.timeOrigin + mostRecentEntry.startTime;\n }\n};\n\nthis.perfService = new _PerfService();\nconst EXPORTED_SYMBOLS = [\"_PerfService\", \"perfService\"];\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/common/PerfService.jsm","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {FormattedMessage, injectIntl} from \"react-intl\";\nimport {\n MIN_CORNER_FAVICON_SIZE,\n MIN_RICH_FAVICON_SIZE,\n TOP_SITES_CONTEXT_MENU_OPTIONS,\n TOP_SITES_SOURCE\n} from \"./TopSitesConstants\";\nimport {LinkMenu} from \"content-src/components/LinkMenu/LinkMenu\";\nimport React from \"react\";\nimport {TOP_SITES_MAX_SITES_PER_ROW} from \"common/Reducers.jsm\";\n\nexport class TopSiteLink extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onDragEvent = this.onDragEvent.bind(this);\n }\n\n /*\n * Helper to determine whether the drop zone should allow a drop. We only allow\n * dropping top sites for now.\n */\n _allowDrop(e) {\n return e.dataTransfer.types.includes(\"text/topsite-index\");\n }\n\n onDragEvent(event) {\n switch (event.type) {\n case \"click\":\n // Stop any link clicks if we started any dragging\n if (this.dragged) {\n event.preventDefault();\n }\n break;\n case \"dragstart\":\n this.dragged = true;\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/topsite-index\", this.props.index);\n event.target.blur();\n this.props.onDragEvent(event, this.props.index, this.props.link, this.props.title);\n break;\n case \"dragend\":\n this.props.onDragEvent(event);\n break;\n case \"dragenter\":\n case \"dragover\":\n case \"drop\":\n if (this._allowDrop(event)) {\n event.preventDefault();\n this.props.onDragEvent(event, this.props.index);\n }\n break;\n case \"mousedown\":\n // Reset at the first mouse event of a potential drag\n this.dragged = false;\n break;\n }\n }\n\n render() {\n const {children, className, isDraggable, link, onClick, title} = this.props;\n const topSiteOuterClassName = `top-site-outer${className ? ` ${className}` : \"\"}${link.isDragged ? \" dragged\" : \"\"}`;\n const {tippyTopIcon, faviconSize} = link;\n const [letterFallback] = title;\n let imageClassName;\n let imageStyle;\n let showSmallFavicon = false;\n let smallFaviconStyle;\n let smallFaviconFallback;\n if (tippyTopIcon || faviconSize >= MIN_RICH_FAVICON_SIZE) {\n // styles and class names for top sites with rich icons\n imageClassName = \"top-site-icon rich-icon\";\n imageStyle = {\n backgroundColor: link.backgroundColor,\n backgroundImage: `url(${tippyTopIcon || link.favicon})`\n };\n } else {\n // styles and class names for top sites with screenshot + small icon in top left corner\n imageClassName = `screenshot${link.screenshot ? \" active\" : \"\"}`;\n imageStyle = {backgroundImage: link.screenshot ? `url(${link.screenshot})` : \"none\"};\n\n // only show a favicon in top left if it's greater than 16x16\n if (faviconSize >= MIN_CORNER_FAVICON_SIZE) {\n showSmallFavicon = true;\n smallFaviconStyle = {backgroundImage: `url(${link.favicon})`};\n } else if (link.screenshot) {\n // Don't show a small favicon if there is no screenshot, because that\n // would result in two fallback icons\n showSmallFavicon = true;\n smallFaviconFallback = true;\n }\n }\n let draggableProps = {};\n if (isDraggable) {\n draggableProps = {\n onClick: this.onDragEvent,\n onDragEnd: this.onDragEvent,\n onDragStart: this.onDragEvent,\n onMouseDown: this.onDragEvent\n };\n }\n return (<li className={topSiteOuterClassName} onDrop={this.onDragEvent} onDragOver={this.onDragEvent} onDragEnter={this.onDragEvent} onDragLeave={this.onDragEvent} {...draggableProps}>\n <div className=\"top-site-inner\">\n <a href={link.url} onClick={onClick}>\n <div className=\"tile\" aria-hidden={true} data-fallback={letterFallback}>\n <div className={imageClassName} style={imageStyle} />\n {showSmallFavicon && <div\n className=\"top-site-icon default-icon\"\n data-fallback={smallFaviconFallback && letterFallback}\n style={smallFaviconStyle} />}\n </div>\n <div className={`title ${link.isPinned ? \"pinned\" : \"\"}`}>\n {link.isPinned && <div className=\"icon icon-pin-small\" />}\n <span dir=\"auto\">{title}</span>\n </div>\n </a>\n {children}\n </div>\n </li>);\n }\n}\nTopSiteLink.defaultProps = {\n title: \"\",\n link: {},\n isDraggable: true\n};\n\nexport class TopSite extends React.PureComponent {\n constructor(props) {\n super(props);\n this.state = {showContextMenu: false};\n this.onLinkClick = this.onLinkClick.bind(this);\n this.onMenuButtonClick = this.onMenuButtonClick.bind(this);\n this.onMenuUpdate = this.onMenuUpdate.bind(this);\n }\n\n /**\n * Report to telemetry additional information about the item.\n */\n _getTelemetryInfo() {\n const value = {icon_type: this.props.link.iconType};\n // Filter out \"not_pinned\" type for being the default\n if (this.props.link.isPinned) {\n value.card_type = \"pinned\";\n }\n return {value};\n }\n\n userEvent(event) {\n this.props.dispatch(ac.UserEvent(Object.assign({\n event,\n source: TOP_SITES_SOURCE,\n action_position: this.props.index\n }, this._getTelemetryInfo())));\n }\n\n onLinkClick(ev) {\n this.userEvent(\"CLICK\");\n }\n\n onMenuButtonClick(event) {\n event.preventDefault();\n this.props.onActivate(this.props.index);\n this.setState({showContextMenu: true});\n }\n\n onMenuUpdate(showContextMenu) {\n this.setState({showContextMenu});\n }\n\n render() {\n const {props} = this;\n const {link} = props;\n const isContextMenuOpen = this.state.showContextMenu && props.activeIndex === props.index;\n const title = link.label || link.hostname;\n return (<TopSiteLink {...props} onClick={this.onLinkClick} onDragEvent={this.props.onDragEvent} className={`${props.className || \"\"}${isContextMenuOpen ? \" active\" : \"\"}`} title={title}>\n <div>\n <button className=\"context-menu-button icon\" onClick={this.onMenuButtonClick}>\n <span className=\"sr-only\">\n <FormattedMessage id=\"context_menu_button_sr\" values={{title}} />\n </span>\n </button>\n {isContextMenuOpen &&\n <LinkMenu\n dispatch={props.dispatch}\n index={props.index}\n onUpdate={this.onMenuUpdate}\n options={TOP_SITES_CONTEXT_MENU_OPTIONS}\n site={link}\n siteInfo={this._getTelemetryInfo()}\n source={TOP_SITES_SOURCE} />\n }\n </div>\n </TopSiteLink>);\n }\n}\nTopSite.defaultProps = {\n link: {},\n onActivate() {}\n};\n\nexport class TopSitePlaceholder extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onEditButtonClick = this.onEditButtonClick.bind(this);\n }\n\n onEditButtonClick() {\n this.props.dispatch(\n {type: at.TOP_SITES_EDIT, data: {index: this.props.index}});\n }\n\n render() {\n return (<TopSiteLink {...this.props} className={`placeholder ${this.props.className || \"\"}`} isDraggable={false}>\n <button className=\"context-menu-button edit-button icon\"\n title={this.props.intl.formatMessage({id: \"edit_topsites_edit_button\"})}\n onClick={this.onEditButtonClick} />\n </TopSiteLink>);\n }\n}\n\nexport class _TopSiteList extends React.PureComponent {\n static get DEFAULT_STATE() {\n return {\n activeIndex: null,\n draggedIndex: null,\n draggedSite: null,\n draggedTitle: null,\n topSitesPreview: null\n };\n }\n\n constructor(props) {\n super(props);\n this.state = _TopSiteList.DEFAULT_STATE;\n this.onDragEvent = this.onDragEvent.bind(this);\n this.onActivate = this.onActivate.bind(this);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.state.draggedSite) {\n const prevTopSites = this.props.TopSites && this.props.TopSites.rows;\n const newTopSites = nextProps.TopSites && nextProps.TopSites.rows;\n if (prevTopSites && prevTopSites[this.state.draggedIndex] &&\n prevTopSites[this.state.draggedIndex].url === this.state.draggedSite.url &&\n (!newTopSites[this.state.draggedIndex] || newTopSites[this.state.draggedIndex].url !== this.state.draggedSite.url)) {\n // We got the new order from the redux store via props. We can clear state now.\n this.setState(_TopSiteList.DEFAULT_STATE);\n }\n }\n }\n\n userEvent(event, index) {\n this.props.dispatch(ac.UserEvent({\n event,\n source: TOP_SITES_SOURCE,\n action_position: index\n }));\n }\n\n onDragEvent(event, index, link, title) {\n switch (event.type) {\n case \"dragstart\":\n this.dropped = false;\n this.setState({\n draggedIndex: index,\n draggedSite: link,\n draggedTitle: title,\n activeIndex: null\n });\n this.userEvent(\"DRAG\", index);\n break;\n case \"dragend\":\n if (!this.dropped) {\n // If there was no drop event, reset the state to the default.\n this.setState(_TopSiteList.DEFAULT_STATE);\n }\n break;\n case \"dragenter\":\n if (index === this.state.draggedIndex) {\n this.setState({topSitesPreview: null});\n } else {\n this.setState({topSitesPreview: this._makeTopSitesPreview(index)});\n }\n break;\n case \"drop\":\n if (index !== this.state.draggedIndex) {\n this.dropped = true;\n this.props.dispatch(ac.AlsoToMain({\n type: at.TOP_SITES_INSERT,\n data: {site: {url: this.state.draggedSite.url, label: this.state.draggedTitle}, index, draggedFromIndex: this.state.draggedIndex}\n }));\n this.userEvent(\"DROP\", index);\n }\n break;\n }\n }\n\n _getTopSites() {\n // Make a copy of the sites to truncate or extend to desired length\n let topSites = this.props.TopSites.rows.slice();\n topSites.length = this.props.TopSitesRows * TOP_SITES_MAX_SITES_PER_ROW;\n return topSites;\n }\n\n /**\n * Make a preview of the topsites that will be the result of dropping the currently\n * dragged site at the specified index.\n */\n _makeTopSitesPreview(index) {\n const topSites = this._getTopSites();\n topSites[this.state.draggedIndex] = null;\n const pinnedOnly = topSites.map(site => ((site && site.isPinned) ? site : null));\n const unpinned = topSites.filter(site => site && !site.isPinned);\n const siteToInsert = Object.assign({}, this.state.draggedSite, {isPinned: true, isDragged: true});\n if (!pinnedOnly[index]) {\n pinnedOnly[index] = siteToInsert;\n } else {\n // Find the hole to shift the pinned site(s) towards. We shift towards the\n // hole left by the site being dragged.\n let holeIndex = index;\n const indexStep = index > this.state.draggedIndex ? -1 : 1;\n while (pinnedOnly[holeIndex]) {\n holeIndex += indexStep;\n }\n\n // Shift towards the hole.\n const shiftingStep = index > this.state.draggedIndex ? 1 : -1;\n while (holeIndex !== index) {\n const nextIndex = holeIndex + shiftingStep;\n pinnedOnly[holeIndex] = pinnedOnly[nextIndex];\n holeIndex = nextIndex;\n }\n pinnedOnly[index] = siteToInsert;\n }\n\n // Fill in the remaining holes with unpinned sites.\n const preview = pinnedOnly;\n for (let i = 0; i < preview.length; i++) {\n if (!preview[i]) {\n preview[i] = unpinned.shift() || null;\n }\n }\n\n return preview;\n }\n\n onActivate(index) {\n this.setState({activeIndex: index});\n }\n\n render() {\n const {props} = this;\n const topSites = this.state.topSitesPreview || this._getTopSites();\n const topSitesUI = [];\n const commonProps = {\n onDragEvent: this.onDragEvent,\n dispatch: props.dispatch,\n intl: props.intl\n };\n // We assign a key to each placeholder slot. We need it to be independent\n // of the slot index (i below) so that the keys used stay the same during\n // drag and drop reordering and the underlying DOM nodes are reused.\n // This mostly (only?) affects linux so be sure to test on linux before changing.\n let holeIndex = 0;\n\n // On narrow viewports, we only show 6 sites per row. We'll mark the rest as\n // .hide-for-narrow to hide in CSS via @media query.\n const maxNarrowVisibleIndex = props.TopSitesRows * 6;\n\n for (let i = 0, l = topSites.length; i < l; i++) {\n const link = topSites[i] && Object.assign({}, topSites[i], {iconType: this.props.topSiteIconType(topSites[i])});\n const slotProps = {\n key: link ? link.url : holeIndex++,\n index: i\n };\n if (i >= maxNarrowVisibleIndex) {\n slotProps.className = \"hide-for-narrow\";\n }\n topSitesUI.push(!link ? (\n <TopSitePlaceholder\n {...slotProps}\n {...commonProps} />\n ) : (\n <TopSite\n link={link}\n activeIndex={this.state.activeIndex}\n onActivate={this.onActivate}\n {...slotProps}\n {...commonProps} />\n ));\n }\n return (<ul className={`top-sites-list${this.state.draggedSite ? \" dnd-active\" : \"\"}`}>\n {topSitesUI}\n </ul>);\n }\n}\n\nexport const TopSiteList = injectIntl(_TopSiteList);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/TopSites/TopSite.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {addSnippetsSubscriber} from \"content-src/lib/snippets\";\nimport {Base} from \"content-src/components/Base/Base\";\nimport {DetectUserSessionStart} from \"content-src/lib/detect-user-session-start\";\nimport {initStore} from \"content-src/lib/init-store\";\nimport {Provider} from \"react-redux\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport {reducers} from \"common/Reducers.jsm\";\n\nconst store = initStore(reducers, global.gActivityStreamPrerenderedState);\n\nnew DetectUserSessionStart(store).sendEventOrAddListener();\n\n// If we are starting in a prerendered state, we must wait until the first render\n// to request state rehydration (see Base.jsx). If we are NOT in a prerendered state,\n// we can request it immedately.\nif (!global.gActivityStreamPrerenderedState) {\n store.dispatch(ac.AlsoToMain({type: at.NEW_TAB_STATE_REQUEST}));\n}\n\nReactDOM.hydrate(<Provider store={store}>\n <Base\n isPrerendered={!!global.gActivityStreamPrerenderedState}\n locale={global.document.documentElement.lang}\n strings={global.gActivityStreamStrings} />\n</Provider>, document.getElementById(\"root\"));\n\naddSnippetsSubscriber(store);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/activity-stream.jsx","const DATABASE_NAME = \"snippets_db\";\nconst DATABASE_VERSION = 1;\nconst SNIPPETS_OBJECTSTORE_NAME = \"snippets\";\nexport const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.\n\nconst SNIPPETS_ENABLED_EVENT = \"Snippets:Enabled\";\nconst SNIPPETS_DISABLED_EVENT = \"Snippets:Disabled\";\n\nimport {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\n\n/**\n * SnippetsMap - A utility for cacheing values related to the snippet. It has\n * the same interface as a Map, but is optionally backed by\n * indexedDB for persistent storage.\n * Call .connect() to open a database connection and restore any\n * previously cached data, if necessary.\n *\n */\nexport class SnippetsMap extends Map {\n constructor(dispatch) {\n super();\n this._db = null;\n this._dispatch = dispatch;\n }\n\n set(key, value) {\n super.set(key, value);\n return this._dbTransaction(db => db.put(value, key));\n }\n\n delete(key) {\n super.delete(key);\n return this._dbTransaction(db => db.delete(key));\n }\n\n clear() {\n super.clear();\n this._dispatch(ac.OnlyToMain({type: at.SNIPPETS_BLOCKLIST_CLEARED}));\n return this._dbTransaction(db => db.clear());\n }\n\n get blockList() {\n return this.get(\"blockList\") || [];\n }\n\n /**\n * blockSnippetById - Blocks a snippet given an id\n *\n * @param {str|int} id The id of the snippet\n * @return {Promise} Resolves when the id has been written to indexedDB,\n * or immediately if the snippetMap is not connected\n */\n async blockSnippetById(id) {\n if (!id) {\n return;\n }\n const {blockList} = this;\n if (!blockList.includes(id)) {\n blockList.push(id);\n this._dispatch(ac.AlsoToMain({type: at.SNIPPETS_BLOCKLIST_UPDATED, data: id}));\n await this.set(\"blockList\", blockList);\n }\n }\n\n disableOnboarding() {\n this._dispatch(ac.AlsoToMain({type: at.DISABLE_ONBOARDING}));\n }\n\n showFirefoxAccounts() {\n this._dispatch(ac.AlsoToMain({type: at.SHOW_FIREFOX_ACCOUNTS}));\n }\n\n getTotalBookmarksCount() {\n return new Promise(resolve => {\n this._dispatch(ac.OnlyToMain({type: at.TOTAL_BOOKMARKS_REQUEST}));\n global.addMessageListener(\"ActivityStream:MainToContent\", function onMessage({data: action}) {\n if (action.type === at.TOTAL_BOOKMARKS_RESPONSE) {\n resolve(action.data);\n global.removeMessageListener(\"ActivityStream:MainToContent\", onMessage);\n }\n });\n });\n }\n\n /**\n * connect - Attaches an indexedDB back-end to the Map so that any set values\n * are also cached in a store. It also restores any existing values\n * that are already stored in the indexedDB store.\n *\n * @return {type} description\n */\n async connect() {\n // Open the connection\n const db = await this._openDB();\n\n // Restore any existing values\n await this._restoreFromDb(db);\n\n // Attach a reference to the db\n this._db = db;\n }\n\n /**\n * _dbTransaction - Returns a db transaction wrapped with the given modifier\n * function as a Promise. If the db has not been connected,\n * it resolves immediately.\n *\n * @param {func} modifier A function to call with the transaction\n * @return {obj} A Promise that resolves when the transaction has\n * completed or errored\n */\n _dbTransaction(modifier) {\n if (!this._db) {\n return Promise.resolve();\n }\n return new Promise((resolve, reject) => {\n const transaction = modifier(\n this._db\n .transaction(SNIPPETS_OBJECTSTORE_NAME, \"readwrite\")\n .objectStore(SNIPPETS_OBJECTSTORE_NAME)\n );\n transaction.onsuccess = event => resolve();\n\n /* istanbul ignore next */\n transaction.onerror = event => reject(transaction.error);\n });\n }\n\n _openDB() {\n return new Promise((resolve, reject) => {\n const openRequest = indexedDB.open(DATABASE_NAME, DATABASE_VERSION);\n\n /* istanbul ignore next */\n openRequest.onerror = event => {\n // Try to delete the old database so that we can start this process over\n // next time.\n indexedDB.deleteDatabase(DATABASE_NAME);\n reject(event);\n };\n\n openRequest.onupgradeneeded = event => {\n const db = event.target.result;\n if (!db.objectStoreNames.contains(SNIPPETS_OBJECTSTORE_NAME)) {\n db.createObjectStore(SNIPPETS_OBJECTSTORE_NAME);\n }\n };\n\n openRequest.onsuccess = event => {\n let db = event.target.result;\n\n /* istanbul ignore next */\n db.onerror = err => console.error(err); // eslint-disable-line no-console\n /* istanbul ignore next */\n db.onversionchange = versionChangeEvent => versionChangeEvent.target.close();\n\n resolve(db);\n };\n });\n }\n\n _restoreFromDb(db) {\n return new Promise((resolve, reject) => {\n let cursorRequest;\n try {\n cursorRequest = db.transaction(SNIPPETS_OBJECTSTORE_NAME)\n .objectStore(SNIPPETS_OBJECTSTORE_NAME).openCursor();\n } catch (err) {\n // istanbul ignore next\n reject(err);\n // istanbul ignore next\n return;\n }\n\n /* istanbul ignore next */\n cursorRequest.onerror = event => reject(event);\n\n cursorRequest.onsuccess = event => {\n let cursor = event.target.result;\n // Populate the cache from the persistent storage.\n if (cursor) {\n if (cursor.value !== \"blockList\") {\n this.set(cursor.key, cursor.value);\n }\n cursor.continue();\n } else {\n // We are done.\n resolve();\n }\n };\n });\n }\n}\n\n/**\n * SnippetsProvider - Initializes a SnippetsMap and loads snippets from a\n * remote location, or else default snippets if the remote\n * snippets cannot be retrieved.\n */\nexport class SnippetsProvider {\n constructor(dispatch) {\n // Initialize the Snippets Map and attaches it to a global so that\n // the snippet payload can interact with it.\n global.gSnippetsMap = new SnippetsMap(dispatch);\n this._onAction = this._onAction.bind(this);\n }\n\n get snippetsMap() {\n return global.gSnippetsMap;\n }\n\n async _refreshSnippets() {\n // Check if the cached version of of the snippets in snippetsMap. If it's too\n // old, blow away the entire snippetsMap.\n const cachedVersion = this.snippetsMap.get(\"snippets-cached-version\");\n\n if (cachedVersion !== this.appData.version) {\n this.snippetsMap.clear();\n }\n\n // Has enough time passed for us to require an update?\n const lastUpdate = this.snippetsMap.get(\"snippets-last-update\");\n const needsUpdate = !(lastUpdate >= 0) || Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS;\n\n if (needsUpdate && this.appData.snippetsURL) {\n this.snippetsMap.set(\"snippets-last-update\", Date.now());\n try {\n const response = await fetch(this.appData.snippetsURL);\n if (response.status === 200) {\n const payload = await response.text();\n\n this.snippetsMap.set(\"snippets\", payload);\n this.snippetsMap.set(\"snippets-cached-version\", this.appData.version);\n }\n } catch (e) {\n console.error(e); // eslint-disable-line no-console\n }\n }\n }\n\n _noSnippetFallback() {\n // TODO\n }\n\n _forceOnboardingVisibility(shouldBeVisible) {\n const onboardingEl = document.getElementById(\"onboarding-notification-bar\");\n\n if (onboardingEl) {\n onboardingEl.style.display = shouldBeVisible ? \"\" : \"none\";\n }\n }\n\n _showRemoteSnippets() {\n const snippetsEl = document.getElementById(this.elementId);\n const payload = this.snippetsMap.get(\"snippets\");\n\n if (!snippetsEl) {\n throw new Error(`No element was found with id '${this.elementId}'.`);\n }\n\n // This could happen if fetching failed\n if (!payload) {\n throw new Error(\"No remote snippets were found in gSnippetsMap.\");\n }\n\n if (typeof payload !== \"string\") {\n throw new Error(\"Snippet payload was incorrectly formatted\");\n }\n\n // Note that injecting snippets can throw if they're invalid XML.\n // eslint-disable-next-line no-unsanitized/property\n snippetsEl.innerHTML = payload;\n\n // Scripts injected by innerHTML are inactive, so we have to relocate them\n // through DOM manipulation to activate their contents.\n for (const scriptEl of snippetsEl.getElementsByTagName(\"script\")) {\n const relocatedScript = document.createElement(\"script\");\n relocatedScript.text = scriptEl.text;\n scriptEl.parentNode.replaceChild(relocatedScript, scriptEl);\n }\n }\n\n _onAction(msg) {\n if (msg.data.type === at.SNIPPET_BLOCKED) {\n if (!this.snippetsMap.blockList.includes(msg.data.data)) {\n this.snippetsMap.set(\"blockList\", this.snippetsMap.blockList.concat(msg.data.data));\n document.getElementById(\"snippets-container\").style.display = \"none\";\n }\n }\n }\n\n /**\n * init - Fetch the snippet payload and show snippets\n *\n * @param {obj} options\n * @param {str} options.appData.snippetsURL The URL from which we fetch snippets\n * @param {int} options.appData.version The current snippets version\n * @param {str} options.elementId The id of the element in which to inject snippets\n * @param {bool} options.connect Should gSnippetsMap connect to indexedDB?\n */\n async init(options) {\n Object.assign(this, {\n appData: {},\n elementId: \"snippets\",\n connect: true\n }, options);\n\n // Add listener so we know when snippets are blocked on other pages\n if (global.addMessageListener) {\n global.addMessageListener(\"ActivityStream:MainToContent\", this._onAction);\n }\n\n // TODO: Requires enabling indexedDB on newtab\n // Restore the snippets map from indexedDB\n if (this.connect) {\n try {\n await this.snippetsMap.connect();\n } catch (e) {\n console.error(e); // eslint-disable-line no-console\n }\n }\n\n // Cache app data values so they can be accessible from gSnippetsMap\n for (const key of Object.keys(this.appData)) {\n if (key === \"blockList\") {\n this.snippetsMap.set(\"blockList\", this.appData[key]);\n } else {\n this.snippetsMap.set(`appData.${key}`, this.appData[key]);\n }\n }\n\n // Refresh snippets, if enough time has passed.\n await this._refreshSnippets();\n\n // Try showing remote snippets, falling back to defaults if necessary.\n try {\n this._showRemoteSnippets();\n } catch (e) {\n this._noSnippetFallback(e);\n }\n\n window.dispatchEvent(new Event(SNIPPETS_ENABLED_EVENT));\n\n this._forceOnboardingVisibility(true);\n this.initialized = true;\n }\n\n uninit() {\n window.dispatchEvent(new Event(SNIPPETS_DISABLED_EVENT));\n this._forceOnboardingVisibility(false);\n if (global.removeMessageListener) {\n global.removeMessageListener(\"ActivityStream:MainToContent\", this._onAction);\n }\n this.initialized = false;\n }\n}\n\n/**\n * addSnippetsSubscriber - Creates a SnippetsProvider that Initializes\n * when the store has received the appropriate\n * Snippet data.\n *\n * @param {obj} store The redux store\n * @return {obj} Returns the snippets instance and unsubscribe function\n */\nexport function addSnippetsSubscriber(store) {\n const snippets = new SnippetsProvider(store.dispatch);\n\n let initializing = false;\n\n store.subscribe(async () => {\n const state = store.getState();\n // state.Prefs.values[\"feeds.snippets\"]: Should snippets be shown?\n // state.Snippets.initialized Is the snippets data initialized?\n // snippets.initialized: Is SnippetsProvider currently initialised?\n if (state.Prefs.values[\"feeds.snippets\"] &&\n !state.Prefs.values.disableSnippets &&\n state.Snippets.initialized &&\n !snippets.initialized &&\n // Don't call init multiple times\n !initializing\n ) {\n initializing = true;\n await snippets.init({appData: state.Snippets});\n initializing = false;\n } else if (\n (state.Prefs.values[\"feeds.snippets\"] === false ||\n state.Prefs.values.disableSnippets === true) &&\n snippets.initialized\n ) {\n snippets.uninit();\n }\n });\n\n // These values are returned for testing purposes\n return snippets;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/snippets.js","import {actionCreators as ac, actionTypes} from \"common/Actions.jsm\";\nimport {connect} from \"react-redux\";\nimport {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\n\n/**\n * ConfirmDialog component.\n * One primary action button, one cancel button.\n *\n * Content displayed is controlled by `data` prop the component receives.\n * Example:\n * data: {\n * // Any sort of data needed to be passed around by actions.\n * payload: site.url,\n * // Primary button AlsoToMain action.\n * action: \"DELETE_HISTORY_URL\",\n * // Primary button USerEvent action.\n * userEvent: \"DELETE\",\n * // Array of locale ids to display.\n * message_body: [\"confirm_history_delete_p1\", \"confirm_history_delete_notice_p2\"],\n * // Text for primary button.\n * confirm_button_string_id: \"menu_action_delete\"\n * },\n */\nexport class _ConfirmDialog extends React.PureComponent {\n constructor(props) {\n super(props);\n this._handleCancelBtn = this._handleCancelBtn.bind(this);\n this._handleConfirmBtn = this._handleConfirmBtn.bind(this);\n }\n\n _handleCancelBtn() {\n this.props.dispatch({type: actionTypes.DIALOG_CANCEL});\n this.props.dispatch(ac.UserEvent({event: actionTypes.DIALOG_CANCEL, source: this.props.data.eventSource}));\n }\n\n _handleConfirmBtn() {\n this.props.data.onConfirm.forEach(this.props.dispatch);\n }\n\n _renderModalMessage() {\n const message_body = this.props.data.body_string_id;\n\n if (!message_body) {\n return null;\n }\n\n return (<span>\n {message_body.map(msg => <p key={msg}><FormattedMessage id={msg} /></p>)}\n </span>);\n }\n\n render() {\n if (!this.props.visible) {\n return null;\n }\n\n return (<div className=\"confirmation-dialog\">\n <div className=\"modal-overlay\" onClick={this._handleCancelBtn} />\n <div className=\"modal\">\n <section className=\"modal-message\">\n {this.props.data.icon && <span className={`icon icon-spacer icon-${this.props.data.icon}`} />}\n {this._renderModalMessage()}\n </section>\n <section className=\"actions\">\n <button onClick={this._handleCancelBtn}>\n <FormattedMessage id={this.props.data.cancel_button_string_id} />\n </button>\n <button className=\"done\" onClick={this._handleConfirmBtn}>\n <FormattedMessage id={this.props.data.confirm_button_string_id} />\n </button>\n </section>\n </div>\n </div>);\n }\n}\n\nexport const ConfirmDialog = connect(state => state.Dialog)(_ConfirmDialog);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/ConfirmDialog/ConfirmDialog.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {connect} from \"react-redux\";\nimport {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\n\n/**\n * Manual migration component used to start the profile import wizard.\n * Message is presented temporarily and will go away if:\n * 1. User clicks \"No Thanks\"\n * 2. User completed the data import\n * 3. After 3 active days\n * 4. User clicks \"Cancel\" on the import wizard (currently not implemented).\n */\nexport class _ManualMigration extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onLaunchTour = this.onLaunchTour.bind(this);\n this.onCancelTour = this.onCancelTour.bind(this);\n }\n\n onLaunchTour() {\n this.props.dispatch(ac.AlsoToMain({type: at.MIGRATION_START}));\n this.props.dispatch(ac.UserEvent({event: at.MIGRATION_START}));\n }\n\n onCancelTour() {\n this.props.dispatch(ac.AlsoToMain({type: at.MIGRATION_CANCEL}));\n this.props.dispatch(ac.UserEvent({event: at.MIGRATION_CANCEL}));\n }\n\n render() {\n return (<div className=\"manual-migration-container\">\n <p>\n <span className=\"icon icon-import\" />\n <FormattedMessage id=\"manual_migration_explanation2\" />\n </p>\n <div className=\"manual-migration-actions actions\">\n <button className=\"dismiss\" onClick={this.onCancelTour}>\n <FormattedMessage id=\"manual_migration_cancel_button\" />\n </button>\n <button onClick={this.onLaunchTour}>\n <FormattedMessage id=\"manual_migration_import_button\" />\n </button>\n </div>\n </div>);\n }\n}\n\nexport const ManualMigration = connect()(_ManualMigration);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/ManualMigration/ManualMigration.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {FormattedMessage, injectIntl} from \"react-intl\";\nimport {connect} from \"react-redux\";\nimport React from \"react\";\n\nconst getFormattedMessage = message =>\n (typeof message === \"string\" ? <span>{message}</span> : <FormattedMessage {...message} />);\n\nexport const PreferencesInput = props => (\n <section>\n <input type=\"checkbox\" id={props.prefName} name={props.prefName} checked={props.value} disabled={props.disabled} onChange={props.onChange} className={props.className} />\n <label htmlFor={props.prefName} className={props.labelClassName}>\n {getFormattedMessage(props.titleString)}\n </label>\n {props.descString && <p className=\"prefs-input-description\">\n {getFormattedMessage(props.descString)}\n </p>}\n {React.Children.map(props.children,\n child => <div className={`options${child.props.disabled ? \" disabled\" : \"\"}`}>{child}</div>)}\n </section>\n);\n\nexport class _PreferencesPane extends React.PureComponent {\n constructor(props) {\n super(props);\n this.handleClickOutside = this.handleClickOutside.bind(this);\n this.handlePrefChange = this.handlePrefChange.bind(this);\n this.handleSectionChange = this.handleSectionChange.bind(this);\n this.togglePane = this.togglePane.bind(this);\n this.onWrapperMount = this.onWrapperMount.bind(this);\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevProps.PreferencesPane.visible !== this.props.PreferencesPane.visible) {\n // While the sidebar is open, listen for all document clicks.\n if (this.isSidebarOpen()) {\n document.addEventListener(\"click\", this.handleClickOutside);\n } else {\n document.removeEventListener(\"click\", this.handleClickOutside);\n }\n }\n }\n\n isSidebarOpen() {\n return this.props.PreferencesPane.visible;\n }\n\n handleClickOutside(event) {\n // if we are showing the sidebar and there is a click outside, close it.\n if (this.isSidebarOpen() && !this.wrapper.contains(event.target)) {\n this.togglePane();\n }\n }\n\n handlePrefChange({target: {name, checked}}) {\n let value = checked;\n if (name === \"topSitesRows\") {\n value = checked ? 2 : 1;\n }\n this.props.dispatch(ac.SetPref(name, value));\n }\n\n handleSectionChange({target}) {\n const id = target.name;\n const type = target.checked ? at.SECTION_ENABLE : at.SECTION_DISABLE;\n this.props.dispatch(ac.AlsoToMain({type, data: id}));\n }\n\n togglePane() {\n if (this.isSidebarOpen()) {\n this.props.dispatch({type: at.SETTINGS_CLOSE});\n this.props.dispatch(ac.UserEvent({event: \"CLOSE_NEWTAB_PREFS\"}));\n } else {\n this.props.dispatch({type: at.SETTINGS_OPEN});\n this.props.dispatch(ac.UserEvent({event: \"OPEN_NEWTAB_PREFS\"}));\n }\n }\n\n onWrapperMount(wrapper) {\n this.wrapper = wrapper;\n }\n\n render() {\n const {props} = this;\n const prefs = props.Prefs.values;\n const sections = props.Sections;\n const isVisible = this.isSidebarOpen();\n return (\n <div className=\"prefs-pane-wrapper\" ref={this.onWrapperMount}>\n <div className=\"prefs-pane-button\">\n <button\n className={`prefs-button icon ${isVisible ? \"icon-dismiss\" : \"icon-settings\"}`}\n title={props.intl.formatMessage({id: isVisible ? \"settings_pane_done_button\" : \"settings_pane_button_label\"})}\n onClick={this.togglePane} />\n </div>\n <div className=\"prefs-pane\">\n <div className={`sidebar ${isVisible ? \"\" : \"hidden\"}`}>\n <div className=\"prefs-modal-inner-wrapper\">\n <h1><FormattedMessage id=\"settings_pane_header\" /></h1>\n <p><FormattedMessage id=\"settings_pane_body2\" /></p>\n\n <PreferencesInput\n className=\"showSearch\"\n prefName=\"showSearch\"\n value={prefs.showSearch}\n onChange={this.handlePrefChange}\n titleString={{id: \"settings_pane_search_header\"}}\n descString={{id: \"settings_pane_search_body\"}} />\n\n <hr />\n\n <PreferencesInput\n className=\"showTopSites\"\n prefName=\"showTopSites\"\n value={prefs.showTopSites}\n onChange={this.handlePrefChange}\n titleString={{id: \"settings_pane_topsites_header\"}}\n descString={{id: \"settings_pane_topsites_body\"}}>\n\n <PreferencesInput\n className=\"showMoreTopSites\"\n prefName=\"topSitesRows\"\n disabled={!prefs.showTopSites}\n value={prefs.topSitesRows === 2}\n onChange={this.handlePrefChange}\n titleString={{id: \"settings_pane_topsites_options_showmore\"}}\n labelClassName=\"icon icon-topsites\" />\n </PreferencesInput>\n\n {sections\n .filter(section => !section.shouldHidePref)\n .map(({id, title, enabled, pref}) =>\n (<PreferencesInput\n key={id}\n className=\"showSection\"\n prefName={(pref && pref.feed) || id}\n value={enabled}\n onChange={(pref && pref.feed) ? this.handlePrefChange : this.handleSectionChange}\n titleString={(pref && pref.titleString) || title}\n descString={pref && pref.descString}>\n\n {pref && pref.nestedPrefs && pref.nestedPrefs.map(nestedPref =>\n (<PreferencesInput\n key={nestedPref.name}\n prefName={nestedPref.name}\n disabled={!enabled}\n value={prefs[nestedPref.name]}\n onChange={this.handlePrefChange}\n titleString={nestedPref.titleString}\n labelClassName={`icon ${nestedPref.icon}`} />)\n )}\n </PreferencesInput>)\n )}\n {!prefs.disableSnippets && <hr />}\n\n {!prefs.disableSnippets && <PreferencesInput className=\"showSnippets\" prefName=\"feeds.snippets\"\n value={prefs[\"feeds.snippets\"]} onChange={this.handlePrefChange}\n titleString={{id: \"settings_pane_snippets_header\"}}\n descString={{id: \"settings_pane_snippets_body\"}} />}\n\n </div>\n <section className=\"actions\">\n <button className=\"done\" onClick={this.togglePane}>\n <FormattedMessage id=\"settings_pane_done_button\" />\n </button>\n </section>\n </div>\n </div>\n </div>);\n }\n}\n\nexport const PreferencesPane = connect(state => ({\n Prefs: state.Prefs,\n PreferencesPane: state.PreferencesPane,\n Sections: state.Sections\n}))(injectIntl(_PreferencesPane));\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/PreferencesPane/PreferencesPane.jsx","class _PrerenderData {\n constructor(options) {\n this.initialPrefs = options.initialPrefs;\n this.initialSections = options.initialSections;\n this._setValidation(options.validation);\n }\n\n get validation() {\n return this._validation;\n }\n\n set validation(value) {\n this._setValidation(value);\n }\n\n get invalidatingPrefs() {\n return this._invalidatingPrefs;\n }\n\n // This is needed so we can use it in the constructor\n _setValidation(value = []) {\n this._validation = value;\n this._invalidatingPrefs = value.reduce((result, next) => {\n if (typeof next === \"string\") {\n result.push(next);\n return result;\n } else if (next && next.oneOf) {\n return result.concat(next.oneOf);\n }\n throw new Error(\"Your validation configuration is not properly configured\");\n }, []);\n }\n\n arePrefsValid(getPref) {\n for (const prefs of this.validation) {\n // {oneOf: [\"foo\", \"bar\"]}\n if (prefs && prefs.oneOf && !prefs.oneOf.some(name => getPref(name) === this.initialPrefs[name])) {\n return false;\n\n // \"foo\"\n } else if (getPref(prefs) !== this.initialPrefs[prefs]) {\n return false;\n }\n }\n return true;\n }\n}\n\nthis.PrerenderData = new _PrerenderData({\n initialPrefs: {\n \"migrationExpired\": true,\n \"showTopSites\": true,\n \"showSearch\": true,\n \"topSitesRows\": 1,\n \"collapseTopSites\": false,\n \"section.highlights.collapsed\": false,\n \"section.topstories.collapsed\": false,\n \"feeds.section.topstories\": true,\n \"feeds.section.highlights\": true,\n \"enableWideLayout\": true,\n \"sectionOrder\": \"topsites,topstories,highlights\"\n },\n // Prefs listed as invalidating will prevent the prerendered version\n // of AS from being used if their value is something other than what is listed\n // here. This is required because some preferences cause the page layout to be\n // too different for the prerendered version to be used. Unfortunately, this\n // will result in users who have modified some of their preferences not being\n // able to get the benefits of prerendering.\n validation: [\n \"showTopSites\",\n \"showSearch\",\n \"topSitesRows\",\n \"collapseTopSites\",\n \"section.highlights.collapsed\",\n \"section.topstories.collapsed\",\n \"enableWideLayout\",\n \"sectionOrder\",\n // This means if either of these are set to their default values,\n // prerendering can be used.\n {oneOf: [\"feeds.section.topstories\", \"feeds.section.highlights\"]}\n ],\n initialSections: [\n {\n enabled: true,\n icon: \"pocket\",\n id: \"topstories\",\n order: 1,\n title: {id: \"header_recommended_by\", values: {provider: \"Pocket\"}}\n },\n {\n enabled: true,\n id: \"highlights\",\n icon: \"highlights\",\n order: 2,\n title: {id: \"header_highlights\"}\n }\n ]\n});\n\nthis._PrerenderData = _PrerenderData;\nconst EXPORTED_SYMBOLS = [\"PrerenderData\", \"_PrerenderData\"];\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/common/PrerenderData.jsm","/* globals ContentSearchUIController */\n\"use strict\";\n\nimport {FormattedMessage, injectIntl} from \"react-intl\";\nimport {actionCreators as ac} from \"common/Actions.jsm\";\nimport {connect} from \"react-redux\";\nimport {IS_NEWTAB} from \"content-src/lib/constants\";\nimport React from \"react\";\n\nexport class _Search extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onClick = this.onClick.bind(this);\n this.onInputMount = this.onInputMount.bind(this);\n }\n\n handleEvent(event) {\n // Also track search events with our own telemetry\n if (event.detail.type === \"Search\") {\n this.props.dispatch(ac.UserEvent({event: \"SEARCH\"}));\n }\n }\n\n onClick(event) {\n window.gContentSearchController.search(event);\n }\n\n componentWillUnmount() {\n delete window.gContentSearchController;\n }\n\n onInputMount(input) {\n if (input) {\n // The \"healthReportKey\" and needs to be \"newtab\" or \"abouthome\" so that\n // BrowserUsageTelemetry.jsm knows to handle events with this name, and\n // can add the appropriate telemetry probes for search. Without the correct\n // name, certain tests like browser_UsageTelemetry_content.js will fail\n // (See github ticket #2348 for more details)\n const healthReportKey = IS_NEWTAB ? \"newtab\" : \"abouthome\";\n\n // The \"searchSource\" needs to be \"newtab\" or \"homepage\" and is sent with\n // the search data and acts as context for the search request (See\n // nsISearchEngine.getSubmission). It is necessary so that search engine\n // plugins can correctly atribute referrals. (See github ticket #3321 for\n // more details)\n const searchSource = IS_NEWTAB ? \"newtab\" : \"homepage\";\n\n // gContentSearchController needs to exist as a global so that tests for\n // the existing about:home can find it; and so it allows these tests to pass.\n // In the future, when activity stream is default about:home, this can be renamed\n window.gContentSearchController = new ContentSearchUIController(input, input.parentNode,\n healthReportKey, searchSource);\n addEventListener(\"ContentSearchClient\", this);\n } else {\n window.gContentSearchController = null;\n removeEventListener(\"ContentSearchClient\", this);\n }\n }\n\n /*\n * Do not change the ID on the input field, as legacy newtab code\n * specifically looks for the id 'newtab-search-text' on input fields\n * in order to execute searches in various tests\n */\n render() {\n return (<div className=\"search-wrapper\">\n <label htmlFor=\"newtab-search-text\" className=\"search-label\">\n <span className=\"sr-only\"><FormattedMessage id=\"search_web_placeholder\" /></span>\n </label>\n <input\n id=\"newtab-search-text\"\n maxLength=\"256\"\n placeholder={this.props.intl.formatMessage({id: \"search_web_placeholder\"})}\n ref={this.onInputMount}\n title={this.props.intl.formatMessage({id: \"search_web_placeholder\"})}\n type=\"search\" />\n <button\n id=\"searchSubmit\"\n className=\"search-button\"\n onClick={this.onClick}\n title={this.props.intl.formatMessage({id: \"search_button\"})}>\n <span className=\"sr-only\"><FormattedMessage id=\"search_button\" /></span>\n </button>\n </div>);\n }\n}\n\nexport const Search = connect()(injectIntl(_Search));\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Search/Search.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {addLocaleData, IntlProvider} from \"react-intl\";\nimport {ConfirmDialog} from \"content-src/components/ConfirmDialog/ConfirmDialog\";\nimport {connect} from \"react-redux\";\nimport {ErrorBoundary} from \"content-src/components/ErrorBoundary/ErrorBoundary\";\nimport {ManualMigration} from \"content-src/components/ManualMigration/ManualMigration\";\nimport {PreferencesPane} from \"content-src/components/PreferencesPane/PreferencesPane\";\nimport {PrerenderData} from \"common/PrerenderData.jsm\";\nimport React from \"react\";\nimport {Search} from \"content-src/components/Search/Search\";\nimport {Sections} from \"content-src/components/Sections/Sections\";\n\n// Add the locale data for pluralization and relative-time formatting for now,\n// this just uses english locale data. We can make this more sophisticated if\n// more features are needed.\nfunction addLocaleDataForReactIntl(locale) {\n addLocaleData([{locale, parentLocale: \"en\"}]);\n}\n\nexport class _Base extends React.PureComponent {\n componentWillMount() {\n const {App, locale} = this.props;\n this.sendNewTabRehydrated(App);\n addLocaleDataForReactIntl(locale);\n }\n\n componentDidMount() {\n // Request state AFTER the first render to ensure we don't cause the\n // prerendered DOM to be unmounted. Otherwise, NEW_TAB_STATE_REQUEST is\n // dispatched right after the store is ready.\n if (this.props.isPrerendered) {\n this.props.dispatch(ac.AlsoToMain({type: at.NEW_TAB_STATE_REQUEST}));\n this.props.dispatch(ac.AlsoToMain({type: at.PAGE_PRERENDERED}));\n }\n }\n\n componentWillUpdate({App}) {\n this.sendNewTabRehydrated(App);\n }\n\n // The NEW_TAB_REHYDRATED event is used to inform feeds that their\n // data has been consumed e.g. for counting the number of tabs that\n // have rendered that data.\n sendNewTabRehydrated(App) {\n if (App && App.initialized && !this.renderNotified) {\n this.props.dispatch(ac.AlsoToMain({type: at.NEW_TAB_REHYDRATED, data: {}}));\n this.renderNotified = true;\n }\n }\n\n render() {\n const {props} = this;\n const {App, locale, strings} = props;\n const {initialized} = App;\n\n if (!props.isPrerendered && !initialized) {\n return null;\n }\n\n return (<IntlProvider locale={locale} messages={strings}>\n <ErrorBoundary className=\"base-content-fallback\">\n <BaseContent {...this.props} />\n </ErrorBoundary>\n </IntlProvider>);\n }\n}\n\nexport class BaseContent extends React.PureComponent {\n render() {\n const {props} = this;\n const {App} = props;\n const {initialized} = App;\n const prefs = props.Prefs.values;\n\n const shouldBeFixedToTop = PrerenderData.arePrefsValid(name => prefs[name]);\n\n const outerClassName = `outer-wrapper${shouldBeFixedToTop ? \" fixed-to-top\" : \"\"} ${prefs.enableWideLayout ? \"wide-layout-enabled\" : \"wide-layout-disabled\"}`;\n\n return (\n <div className={outerClassName}>\n <main>\n {prefs.showSearch &&\n <div className=\"non-collapsible-section\">\n <ErrorBoundary>\n <Search />\n </ErrorBoundary>\n </div>\n }\n <div className={`body-wrapper${(initialized ? \" on\" : \"\")}`}>\n {!prefs.migrationExpired &&\n <div className=\"non-collapsible-section\">\n <ManualMigration />\n </div>\n }\n <Sections />\n </div>\n <ConfirmDialog />\n </main>\n {initialized &&\n <div className=\"prefs-pane\">\n <ErrorBoundary className=\"sidebar\"> <PreferencesPane /> </ErrorBoundary>\n </div>\n }\n </div>);\n }\n}\n\nexport const Base = connect(state => ({App: state.App, Prefs: state.Prefs}))(_Base);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Base/Base.jsx","export const IS_NEWTAB = global.document && global.document.documentURI === \"about:newtab\";\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/constants.js","import {Card, PlaceholderCard} from \"content-src/components/Card/Card\";\nimport {FormattedMessage, injectIntl} from \"react-intl\";\nimport {actionCreators as ac} from \"common/Actions.jsm\";\nimport {CollapsibleSection} from \"content-src/components/CollapsibleSection/CollapsibleSection\";\nimport {ComponentPerfTimer} from \"content-src/components/ComponentPerfTimer/ComponentPerfTimer\";\nimport {connect} from \"react-redux\";\nimport React from \"react\";\nimport {Topics} from \"content-src/components/Topics/Topics\";\nimport {TopSites} from \"content-src/components/TopSites/TopSites\";\n\nconst VISIBLE = \"visible\";\nconst VISIBILITY_CHANGE_EVENT = \"visibilitychange\";\nconst CARDS_PER_ROW = 3;\n\nfunction getFormattedMessage(message) {\n return typeof message === \"string\" ? <span>{message}</span> : <FormattedMessage {...message} />;\n}\n\nexport class Section extends React.PureComponent {\n _dispatchImpressionStats() {\n const {props} = this;\n const maxCards = 3 * props.maxRows;\n const cards = props.rows.slice(0, maxCards);\n\n if (this.needsImpressionStats(cards)) {\n props.dispatch(ac.ImpressionStats({\n source: props.eventSource,\n tiles: cards.map(link => ({id: link.guid}))\n }));\n this.impressionCardGuids = cards.map(link => link.guid);\n }\n }\n\n // This sends an event when a user sees a set of new content. If content\n // changes while the page is hidden (i.e. preloaded or on a hidden tab),\n // only send the event if the page becomes visible again.\n sendImpressionStatsOrAddListener() {\n const {props} = this;\n\n if (!props.shouldSendImpressionStats || !props.dispatch) {\n return;\n }\n\n if (props.document.visibilityState === VISIBLE) {\n this._dispatchImpressionStats();\n } else {\n // We should only ever send the latest impression stats ping, so remove any\n // older listeners.\n if (this._onVisibilityChange) {\n props.document.removeEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n\n // When the page becomes visible, send the impression stats ping if the section isn't collapsed.\n this._onVisibilityChange = () => {\n if (props.document.visibilityState === VISIBLE) {\n const {id, Prefs} = this.props;\n const isCollapsed = Prefs.values[`section.${id}.collapsed`];\n if (!isCollapsed) {\n this._dispatchImpressionStats();\n }\n props.document.removeEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n };\n props.document.addEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n }\n\n componentDidMount() {\n const {id, rows, Prefs} = this.props;\n const isCollapsed = Prefs.values[`section.${id}.collapsed`];\n if (rows.length && !isCollapsed) {\n this.sendImpressionStatsOrAddListener();\n }\n }\n\n componentDidUpdate(prevProps) {\n const {props} = this;\n const {id, Prefs} = props;\n const isCollapsedPref = `section.${id}.collapsed`;\n const isCollapsed = Prefs.values[isCollapsedPref];\n const wasCollapsed = prevProps.Prefs.values[isCollapsedPref];\n if (\n // Don't send impression stats for the empty state\n props.rows.length &&\n (\n // We only want to send impression stats if the content of the cards has changed\n // and the section is not collapsed...\n (props.rows !== prevProps.rows && !isCollapsed) ||\n // or if we are expanding a section that was collapsed.\n (wasCollapsed && !isCollapsed)\n )\n ) {\n this.sendImpressionStatsOrAddListener();\n }\n }\n\n componentWillUnmount() {\n if (this._onVisibilityChange) {\n this.props.document.removeEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n }\n\n needsImpressionStats(cards) {\n if (!this.impressionCardGuids || (this.impressionCardGuids.length !== cards.length)) {\n return true;\n }\n\n for (let i = 0; i < cards.length; i++) {\n if (cards[i].guid !== this.impressionCardGuids[i]) {\n return true;\n }\n }\n\n return false;\n }\n\n numberOfPlaceholders(items) {\n if (items === 0) {\n return CARDS_PER_ROW;\n }\n const remainder = items % CARDS_PER_ROW;\n if (remainder === 0) {\n return 0;\n }\n return CARDS_PER_ROW - remainder;\n }\n\n render() {\n const {\n id, eventSource, title, icon, rows,\n emptyState, dispatch, maxRows,\n contextMenuOptions, initialized, disclaimer,\n pref, privacyNoticeURL, isFirst, isLast\n } = this.props;\n const maxCards = CARDS_PER_ROW * maxRows;\n\n // Show topics only for top stories and if it's not initialized yet (so\n // content doesn't shift when it is loaded) or has loaded with topics\n const shouldShowTopics = (id === \"topstories\" &&\n (!this.props.topics || this.props.topics.length > 0));\n\n const realRows = rows.slice(0, maxCards);\n const placeholders = this.numberOfPlaceholders(realRows.length);\n\n // The empty state should only be shown after we have initialized and there is no content.\n // Otherwise, we should show placeholders.\n const shouldShowEmptyState = initialized && !rows.length;\n\n // <Section> <-- React component\n // <section> <-- HTML5 element\n return (<ComponentPerfTimer {...this.props}>\n <CollapsibleSection className=\"section\" icon={icon}\n title={getFormattedMessage(title)}\n id={id}\n eventSource={eventSource}\n disclaimer={disclaimer}\n prefName={`section.${id}.collapsed`}\n showPrefName={(pref && pref.feed) || id}\n privacyNoticeURL={privacyNoticeURL}\n Prefs={this.props.Prefs}\n isFirst={isFirst}\n isLast={isLast}\n dispatch={this.props.dispatch}>\n\n {!shouldShowEmptyState && (<ul className=\"section-list\" style={{padding: 0}}>\n {realRows.map((link, index) => link &&\n <Card key={index} index={index} dispatch={dispatch} link={link} contextMenuOptions={contextMenuOptions}\n eventSource={eventSource} shouldSendImpressionStats={this.props.shouldSendImpressionStats} isWebExtension={this.props.isWebExtension} />)}\n {placeholders > 0 && [...new Array(placeholders)].map((_, i) => <PlaceholderCard key={i} />)}\n </ul>)}\n {shouldShowEmptyState &&\n <div className=\"section-empty-state\">\n <div className=\"empty-state\">\n {emptyState.icon && emptyState.icon.startsWith(\"moz-extension://\") ?\n <img className=\"empty-state-icon icon\" style={{\"background-image\": `url('${emptyState.icon}')`}} /> :\n <img className={`empty-state-icon icon icon-${emptyState.icon}`} />}\n <p className=\"empty-state-message\">\n {getFormattedMessage(emptyState.message)}\n </p>\n </div>\n </div>}\n {shouldShowTopics && <Topics topics={this.props.topics} read_more_endpoint={this.props.read_more_endpoint} />}\n </CollapsibleSection>\n </ComponentPerfTimer>);\n }\n}\n\nSection.defaultProps = {\n document: global.document,\n rows: [],\n emptyState: {},\n title: \"\"\n};\n\nexport const SectionIntl = connect(state => ({Prefs: state.Prefs}))(injectIntl(Section));\n\nexport class _Sections extends React.PureComponent {\n renderSections() {\n const sections = [];\n const enabledSections = this.props.Sections.filter(section => section.enabled);\n const {sectionOrder, showTopSites} = this.props.Prefs.values;\n // Enabled sections doesn't include Top Sites, so we add it if enabled.\n const expectedCount = enabledSections.length + ~~showTopSites;\n\n for (const sectionId of sectionOrder.split(\",\")) {\n const commonProps = {\n key: sectionId,\n isFirst: sections.length === 0,\n isLast: sections.length === expectedCount - 1\n };\n if (sectionId === \"topsites\" && showTopSites) {\n sections.push(<TopSites {...commonProps} />);\n } else {\n const section = enabledSections.find(s => s.id === sectionId);\n if (section) {\n sections.push(<SectionIntl {...section} {...commonProps} />);\n }\n }\n }\n return sections;\n }\n\n render() {\n return (\n <div className=\"sections-list\">\n {this.renderSections()}\n </div>\n );\n }\n}\n\nexport const Sections = connect(state => ({Sections: state.Sections, Prefs: state.Prefs}))(_Sections);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Sections/Sections.jsx","export const cardContextTypes = {\n history: {\n intlID: \"type_label_visited\",\n icon: \"historyItem\"\n },\n bookmark: {\n intlID: \"type_label_bookmarked\",\n icon: \"bookmark-added\"\n },\n trending: {\n intlID: \"type_label_recommended\",\n icon: \"trending\"\n },\n now: {\n intlID: \"type_label_now\",\n icon: \"now\"\n },\n pocket: {\n intlID: \"type_label_pocket\",\n icon: \"pocket-small\"\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Card/types.js","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {cardContextTypes} from \"./types\";\nimport {FormattedMessage} from \"react-intl\";\nimport {LinkMenu} from \"content-src/components/LinkMenu/LinkMenu\";\nimport React from \"react\";\n\n// Keep track of pending image loads to only request once\nconst gImageLoading = new Map();\n\n/**\n * Card component.\n * Cards are found within a Section component and contain information about a link such\n * as preview image, page title, page description, and some context about if the page\n * was visited, bookmarked, trending etc...\n * Each Section can make an unordered list of Cards which will create one instane of\n * this class. Each card will then get a context menu which reflects the actions that\n * can be done on this Card.\n */\nexport class Card extends React.PureComponent {\n constructor(props) {\n super(props);\n this.state = {\n activeCard: null,\n imageLoaded: false,\n showContextMenu: false\n };\n this.onMenuButtonClick = this.onMenuButtonClick.bind(this);\n this.onMenuUpdate = this.onMenuUpdate.bind(this);\n this.onLinkClick = this.onLinkClick.bind(this);\n }\n\n /**\n * Helper to conditionally load an image and update state when it loads.\n */\n async maybeLoadImage() {\n // No need to load if it's already loaded or no image\n const {image} = this.props.link;\n if (!this.state.imageLoaded && image) {\n // Initialize a promise to share a load across multiple card updates\n if (!gImageLoading.has(image)) {\n const loaderPromise = new Promise((resolve, reject) => {\n const loader = new Image();\n loader.addEventListener(\"load\", resolve);\n loader.addEventListener(\"error\", reject);\n loader.src = image;\n });\n\n // Save and remove the promise only while it's pending\n gImageLoading.set(image, loaderPromise);\n loaderPromise.catch(ex => ex).then(() => gImageLoading.delete(image)).catch();\n }\n\n // Wait for the image whether just started loading or reused promise\n await gImageLoading.get(image);\n\n // Only update state if we're still waiting to load the original image\n if (this.props.link.image === image && !this.state.imageLoaded) {\n this.setState({imageLoaded: true});\n }\n }\n }\n\n onMenuButtonClick(event) {\n event.preventDefault();\n this.setState({\n activeCard: this.props.index,\n showContextMenu: true\n });\n }\n\n /**\n * Report to telemetry additional information about the item.\n */\n _getTelemetryInfo() {\n // Filter out \"history\" type for being the default\n if (this.props.link.type !== \"history\") {\n return {value: {card_type: this.props.link.type}};\n }\n\n return null;\n }\n\n onLinkClick(event) {\n event.preventDefault();\n const {altKey, button, ctrlKey, metaKey, shiftKey} = event;\n this.props.dispatch(ac.AlsoToMain({\n type: at.OPEN_LINK,\n data: Object.assign(this.props.link, {event: {altKey, button, ctrlKey, metaKey, shiftKey}})\n }));\n\n if (this.props.isWebExtension) {\n this.props.dispatch(ac.WebExtEvent(at.WEBEXT_CLICK, {\n source: this.props.eventSource,\n url: this.props.link.url,\n action_position: this.props.index\n }));\n } else {\n this.props.dispatch(ac.UserEvent(Object.assign({\n event: \"CLICK\",\n source: this.props.eventSource,\n action_position: this.props.index\n }, this._getTelemetryInfo())));\n\n if (this.props.shouldSendImpressionStats) {\n this.props.dispatch(ac.ImpressionStats({\n source: this.props.eventSource,\n click: 0,\n tiles: [{id: this.props.link.guid, pos: this.props.index}]\n }));\n }\n }\n }\n\n onMenuUpdate(showContextMenu) {\n this.setState({showContextMenu});\n }\n\n componentDidMount() {\n this.maybeLoadImage();\n }\n\n componentDidUpdate() {\n this.maybeLoadImage();\n }\n\n componentWillReceiveProps(nextProps) {\n // Clear the image state if changing images\n if (nextProps.link.image !== this.props.link.image) {\n this.setState({imageLoaded: false});\n }\n }\n\n render() {\n const {index, link, dispatch, contextMenuOptions, eventSource, shouldSendImpressionStats} = this.props;\n const {props} = this;\n const isContextMenuOpen = this.state.showContextMenu && this.state.activeCard === index;\n // Display \"now\" as \"trending\" until we have new strings #3402\n const {icon, intlID} = cardContextTypes[link.type === \"now\" ? \"trending\" : link.type] || {};\n const hasImage = link.image || link.hasImage;\n const imageStyle = {backgroundImage: link.image ? `url(${link.image})` : \"none\"};\n\n return (<li className={`card-outer${isContextMenuOpen ? \" active\" : \"\"}${props.placeholder ? \" placeholder\" : \"\"}`}>\n <a href={link.type === \"pocket\" ? link.open_url : link.url} onClick={!props.placeholder ? this.onLinkClick : undefined}>\n <div className=\"card\">\n {hasImage && <div className=\"card-preview-image-outer\">\n <div className={`card-preview-image${this.state.imageLoaded ? \" loaded\" : \"\"}`} style={imageStyle} />\n </div>}\n <div className={`card-details${hasImage ? \"\" : \" no-image\"}`}>\n {link.hostname && <div className=\"card-host-name\">{link.hostname}</div>}\n <div className={[\n \"card-text\",\n icon ? \"\" : \"no-context\",\n link.description ? \"\" : \"no-description\",\n link.hostname ? \"\" : \"no-host-name\",\n hasImage ? \"\" : \"no-image\"\n ].join(\" \")}>\n <h4 className=\"card-title\" dir=\"auto\">{link.title}</h4>\n <p className=\"card-description\" dir=\"auto\">{link.description}</p>\n </div>\n <div className=\"card-context\">\n {icon && !link.context && <span className={`card-context-icon icon icon-${icon}`} />}\n {link.icon && link.context && <span className=\"card-context-icon icon\" style={{backgroundImage: `url('${link.icon}')`}} />}\n {intlID && !link.context && <div className=\"card-context-label\"><FormattedMessage id={intlID} defaultMessage=\"Visited\" /></div>}\n {link.context && <div className=\"card-context-label\">{link.context}</div>}\n </div>\n </div>\n </div>\n </a>\n {!props.placeholder && <button className=\"context-menu-button icon\"\n onClick={this.onMenuButtonClick}>\n <span className=\"sr-only\">{`Open context menu for ${link.title}`}</span>\n </button>}\n {isContextMenuOpen &&\n <LinkMenu\n dispatch={dispatch}\n index={index}\n source={eventSource}\n onUpdate={this.onMenuUpdate}\n options={link.contextMenuOptions || contextMenuOptions}\n site={link}\n siteInfo={this._getTelemetryInfo()}\n shouldSendImpressionStats={shouldSendImpressionStats} />\n }\n </li>);\n }\n}\nCard.defaultProps = {link: {}};\n\nexport const PlaceholderCard = () => <Card placeholder={true} />;\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Card/Card.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\n\n/**\n * List of functions that return items that can be included as menu options in a\n * SectionMenu. All functions take the section as the only parameter.\n */\nexport const SectionMenuOptions = {\n Separator: () => ({type: \"separator\"}),\n MoveUp: section => ({\n id: \"section_menu_action_move_up\",\n icon: \"arrowhead-up\",\n action: ac.OnlyToMain({\n type: at.SECTION_MOVE,\n data: {id: section.id, direction: -1}\n }),\n userEvent: \"SECTION_MENU_MOVE_UP\",\n disabled: !!section.isFirst\n }),\n MoveDown: section => ({\n id: \"section_menu_action_move_down\",\n icon: \"arrowhead-down\",\n action: ac.OnlyToMain({\n type: at.SECTION_MOVE,\n data: {id: section.id, direction: +1}\n }),\n userEvent: \"SECTION_MENU_MOVE_DOWN\",\n disabled: !!section.isLast\n }),\n RemoveSection: section => ({\n id: \"section_menu_action_remove_section\",\n icon: \"dismiss\",\n action: ac.SetPref(section.showPrefName, false),\n userEvent: \"SECTION_MENU_REMOVE\"\n }),\n CollapseSection: section => ({\n id: \"section_menu_action_collapse_section\",\n icon: \"minimize\",\n action: ac.SetPref(section.collapsePrefName, true),\n userEvent: \"SECTION_MENU_COLLAPSE\"\n }),\n ExpandSection: section => ({\n id: \"section_menu_action_expand_section\",\n icon: \"maximize\",\n action: ac.SetPref(section.collapsePrefName, false),\n userEvent: \"SECTION_MENU_EXPAND\"\n }),\n ManageSection: section => ({\n id: \"section_menu_action_manage_section\",\n icon: \"settings\",\n action: {type: at.SETTINGS_OPEN},\n userEvent: \"SECTION_MENU_MANAGE\"\n }),\n AddTopSite: section => ({\n id: \"section_menu_action_add_topsite\",\n icon: \"add\",\n action: {type: at.TOP_SITES_EDIT, data: {index: -1}},\n userEvent: \"SECTION_MENU_ADD_TOPSITE\"\n }),\n PrivacyNotice: section => ({\n id: \"section_menu_action_privacy_notice\",\n icon: \"info\",\n action: ac.OnlyToMain({\n type: at.OPEN_LINK,\n data: {url: section.privacyNoticeURL}\n }),\n userEvent: \"SECTION_MENU_PRIVACY_NOTICE\"\n }),\n CheckCollapsed: section => (section.isCollapsed ? SectionMenuOptions.ExpandSection(section) : SectionMenuOptions.CollapseSection(section))\n};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/section-menu-options.js","import {actionCreators as ac} from \"common/Actions.jsm\";\nimport {ContextMenu} from \"content-src/components/ContextMenu/ContextMenu\";\nimport {injectIntl} from \"react-intl\";\nimport React from \"react\";\nimport {SectionMenuOptions} from \"content-src/lib/section-menu-options\";\n\nconst DEFAULT_SECTION_MENU_OPTIONS = [\"MoveUp\", \"MoveDown\", \"Separator\", \"RemoveSection\", \"CheckCollapsed\", \"Separator\", \"ManageSection\"];\n\nexport class _SectionMenu extends React.PureComponent {\n getOptions() {\n const {props} = this;\n\n const propOptions = Array.from(DEFAULT_SECTION_MENU_OPTIONS);\n // Prepend custom options and a separator\n if (props.extraOptions) {\n propOptions.splice(0, 0, ...props.extraOptions, \"Separator\");\n }\n // Insert privacy notice before the last option (\"ManageSection\")\n if (props.privacyNoticeURL) {\n propOptions.splice(-1, 0, \"PrivacyNotice\");\n }\n\n const options = propOptions.map(o => SectionMenuOptions[o](props)).map(option => {\n const {action, id, type, userEvent} = option;\n if (!type && id) {\n option.label = props.intl.formatMessage({id});\n option.onClick = () => {\n props.dispatch(action);\n if (userEvent) {\n props.dispatch(ac.UserEvent({\n event: userEvent,\n source: props.source\n }));\n }\n };\n }\n return option;\n });\n\n // This is for accessibility to support making each item tabbable.\n // We want to know which item is the first and which item\n // is the last, so we can close the context menu accordingly.\n options[0].first = true;\n options[options.length - 1].last = true;\n return options;\n }\n\n render() {\n return (<ContextMenu\n onUpdate={this.props.onUpdate}\n options={this.getOptions()} />);\n }\n}\n\nexport const SectionMenu = injectIntl(_SectionMenu);\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/SectionMenu/SectionMenu.jsx","import {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\n\nexport class Topic extends React.PureComponent {\n render() {\n const {url, name} = this.props;\n return (<li><a key={name} className=\"topic-link\" href={url}>{name}</a></li>);\n }\n}\n\nexport class Topics extends React.PureComponent {\n render() {\n const {topics, read_more_endpoint} = this.props;\n return (\n <div className=\"topic\">\n <span><FormattedMessage id=\"pocket_read_more\" /></span>\n <ul>{topics && topics.map(t => <Topic key={t.name} url={t.url} name={t.name} />)}</ul>\n\n {read_more_endpoint && <a className=\"topic-read-more\" href={read_more_endpoint}>\n <FormattedMessage id=\"pocket_read_even_more\" />\n </a>}\n </div>\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/Topics/Topics.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {MIN_CORNER_FAVICON_SIZE, MIN_RICH_FAVICON_SIZE, TOP_SITES_SOURCE} from \"./TopSitesConstants\";\nimport {CollapsibleSection} from \"content-src/components/CollapsibleSection/CollapsibleSection\";\nimport {ComponentPerfTimer} from \"content-src/components/ComponentPerfTimer/ComponentPerfTimer\";\nimport {connect} from \"react-redux\";\nimport {injectIntl} from \"react-intl\";\nimport React from \"react\";\nimport {TOP_SITES_MAX_SITES_PER_ROW} from \"common/Reducers.jsm\";\nimport {TopSiteForm} from \"./TopSiteForm\";\nimport {TopSiteList} from \"./TopSite\";\n\nfunction topSiteIconType(link) {\n if (link.tippyTopIcon || link.faviconRef === \"tippytop\") {\n return \"tippytop\";\n }\n if (link.faviconSize >= MIN_RICH_FAVICON_SIZE) {\n return \"rich_icon\";\n }\n if (link.screenshot && link.faviconSize >= MIN_CORNER_FAVICON_SIZE) {\n return \"screenshot_with_icon\";\n }\n if (link.screenshot) {\n return \"screenshot\";\n }\n return \"no_image\";\n}\n\n/**\n * Iterates through TopSites and counts types of images.\n * @param acc Accumulator for reducer.\n * @param topsite Entry in TopSites.\n */\nfunction countTopSitesIconsTypes(topSites) {\n const countTopSitesTypes = (acc, link) => {\n acc[topSiteIconType(link)]++;\n return acc;\n };\n\n return topSites.reduce(countTopSitesTypes, {\n \"screenshot_with_icon\": 0,\n \"screenshot\": 0,\n \"tippytop\": 0,\n \"rich_icon\": 0,\n \"no_image\": 0\n });\n}\n\nexport class _TopSites extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onFormClose = this.onFormClose.bind(this);\n }\n\n /**\n * Dispatch session statistics about the quality of TopSites icons and pinned count.\n */\n _dispatchTopSitesStats() {\n const topSites = this._getVisibleTopSites();\n const topSitesIconsStats = countTopSitesIconsTypes(topSites);\n const topSitesPinned = topSites.filter(site => !!site.isPinned).length;\n // Dispatch telemetry event with the count of TopSites images types.\n this.props.dispatch(ac.AlsoToMain({\n type: at.SAVE_SESSION_PERF_DATA,\n data: {topsites_icon_stats: topSitesIconsStats, topsites_pinned: topSitesPinned}\n }));\n }\n\n /**\n * Return the TopSites that are visible based on prefs and window width.\n */\n _getVisibleTopSites() {\n // We hide 2 sites per row when not in the wide layout.\n let sitesPerRow = TOP_SITES_MAX_SITES_PER_ROW;\n // $break-point-widest = 1072px (from _variables.scss)\n if (!global.matchMedia(`(min-width: 1072px)`).matches) {\n sitesPerRow -= 2;\n }\n return this.props.TopSites.rows.slice(0, this.props.TopSitesRows * sitesPerRow);\n }\n\n componentDidUpdate() {\n this._dispatchTopSitesStats();\n }\n\n componentDidMount() {\n this._dispatchTopSitesStats();\n }\n\n onFormClose() {\n this.props.dispatch(ac.UserEvent({\n source: TOP_SITES_SOURCE,\n event: \"TOP_SITES_EDIT_CLOSE\"\n }));\n this.props.dispatch({type: at.TOP_SITES_CANCEL_EDIT});\n }\n\n render() {\n const {props} = this;\n const {editForm} = props.TopSites;\n\n return (<ComponentPerfTimer id=\"topsites\" initialized={props.TopSites.initialized} dispatch={props.dispatch}>\n <CollapsibleSection\n className=\"top-sites\"\n icon=\"topsites\"\n id=\"topsites\"\n title={props.intl.formatMessage({id: \"header_top_sites\"})}\n extraMenuOptions={[\"AddTopSite\"]}\n prefName=\"collapseTopSites\"\n showPrefName=\"showTopSites\"\n eventSource={TOP_SITES_SOURCE}\n Prefs={props.Prefs}\n isFirst={props.isFirst}\n isLast={props.isLast}\n dispatch={props.dispatch}>\n <TopSiteList TopSites={props.TopSites} TopSitesRows={props.TopSitesRows} dispatch={props.dispatch} intl={props.intl} topSiteIconType={topSiteIconType} />\n <div className=\"edit-topsites-wrapper\">\n {editForm &&\n <div className=\"edit-topsites\">\n <div className=\"modal-overlay\" onClick={this.onFormClose} />\n <div className=\"modal\">\n <TopSiteForm\n site={props.TopSites.rows[editForm.index]}\n index={editForm.index}\n onClose={this.onFormClose}\n dispatch={this.props.dispatch}\n intl={this.props.intl} />\n </div>\n </div>\n }\n </div>\n </CollapsibleSection>\n </ComponentPerfTimer>);\n }\n}\n\nexport const TopSites = connect(state => ({\n TopSites: state.TopSites,\n Prefs: state.Prefs,\n TopSitesRows: state.Prefs.values.topSitesRows\n}))(injectIntl(_TopSites));\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/TopSites/TopSites.jsx","import {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\n\nexport class TopSiteFormInput extends React.PureComponent {\n constructor(props) {\n super(props);\n this.onMount = this.onMount.bind(this);\n }\n\n componentWillReceiveProps(nextProps) {\n if (nextProps.validationError && !this.props.validationError) {\n this.input.focus();\n }\n }\n\n onMount(input) {\n this.input = input;\n }\n\n render() {\n const showClearButton = this.props.value && this.props.onClear;\n const {validationError, typeUrl} = this.props;\n\n return (<label><FormattedMessage id={this.props.titleId} />\n <div className={`field ${typeUrl ? \"url\" : \"\"}${validationError ? \" invalid\" : \"\"}`}>\n {showClearButton &&\n <div className=\"icon icon-clear-input\" onClick={this.props.onClear} />}\n <input type=\"text\"\n value={this.props.value}\n ref={this.onMount}\n onChange={this.props.onChange}\n placeholder={this.props.intl.formatMessage({id: this.props.placeholderId})} />\n {validationError &&\n <aside className=\"error-tooltip\">\n <FormattedMessage id={this.props.errorMessageId} />\n </aside>}\n </div>\n </label>);\n }\n}\n\nTopSiteFormInput.defaultProps = {\n showClearButton: false,\n value: \"\",\n validationError: false\n};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/TopSites/TopSiteFormInput.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {FormattedMessage} from \"react-intl\";\nimport React from \"react\";\nimport {TOP_SITES_SOURCE} from \"./TopSitesConstants\";\nimport {TopSiteFormInput} from \"./TopSiteFormInput\";\nimport {TopSiteLink} from \"./TopSite\";\n\nexport class TopSiteForm extends React.PureComponent {\n constructor(props) {\n super(props);\n const {site} = props;\n this.state = {\n label: site ? (site.label || site.hostname) : \"\",\n url: site ? site.url : \"\",\n validationError: false\n };\n this.onLabelChange = this.onLabelChange.bind(this);\n this.onUrlChange = this.onUrlChange.bind(this);\n this.onCancelButtonClick = this.onCancelButtonClick.bind(this);\n this.onClearUrlClick = this.onClearUrlClick.bind(this);\n this.onDoneButtonClick = this.onDoneButtonClick.bind(this);\n }\n\n onLabelChange(event) {\n this.setState({\"label\": event.target.value});\n }\n\n onUrlChange(event) {\n this.setState({\n url: event.target.value,\n validationError: false\n });\n }\n\n onClearUrlClick() {\n this.setState({\n url: \"\",\n validationError: false\n });\n }\n\n onCancelButtonClick(ev) {\n ev.preventDefault();\n this.props.onClose();\n }\n\n onDoneButtonClick(ev) {\n ev.preventDefault();\n\n if (this.validateForm()) {\n const site = {url: this.cleanUrl(this.state.url)};\n const {index} = this.props;\n if (this.state.label !== \"\") {\n site.label = this.state.label;\n }\n\n this.props.dispatch(ac.AlsoToMain({\n type: at.TOP_SITES_PIN,\n data: {site, index}\n }));\n this.props.dispatch(ac.UserEvent({\n source: TOP_SITES_SOURCE,\n event: \"TOP_SITES_EDIT\",\n action_position: index\n }));\n\n this.props.onClose();\n }\n }\n\n cleanUrl(url) {\n // If we are missing a protocol, prepend http://\n if (!url.startsWith(\"http:\") && !url.startsWith(\"https:\")) {\n return `http://${url}`;\n }\n return url;\n }\n\n validateUrl(url) {\n try {\n return !!new URL(this.cleanUrl(url));\n } catch (e) {\n return false;\n }\n }\n\n validateForm() {\n const validate = this.validateUrl(this.state.url);\n this.setState({validationError: !validate});\n return validate;\n }\n\n render() {\n // For UI purposes, editing without an existing link is \"add\"\n const showAsAdd = !this.props.site;\n\n return (\n <form className=\"topsite-form\">\n <div className=\"form-input-container\">\n <h3 className=\"section-title\">\n <FormattedMessage id={showAsAdd ? \"topsites_form_add_header\" : \"topsites_form_edit_header\"} />\n </h3>\n <div className=\"fields-and-preview\">\n <div className=\"form-wrapper\">\n <TopSiteFormInput onChange={this.onLabelChange}\n value={this.state.label}\n titleId=\"topsites_form_title_label\"\n placeholderId=\"topsites_form_title_placeholder\"\n intl={this.props.intl} />\n <TopSiteFormInput onChange={this.onUrlChange}\n value={this.state.url}\n onClear={this.onClearUrlClick}\n validationError={this.state.validationError}\n titleId=\"topsites_form_url_label\"\n typeUrl={true}\n placeholderId=\"topsites_form_url_placeholder\"\n errorMessageId=\"topsites_form_url_validation\"\n intl={this.props.intl} />\n </div>\n <TopSiteLink link={this.props.site || {}} title={this.state.label} />\n </div>\n </div>\n <section className=\"actions\">\n <button className=\"cancel\" type=\"button\" onClick={this.onCancelButtonClick}>\n <FormattedMessage id=\"topsites_form_cancel_button\" />\n </button>\n <button className=\"done\" type=\"submit\" onClick={this.onDoneButtonClick}>\n <FormattedMessage id={showAsAdd ? \"topsites_form_add_button\" : \"topsites_form_save_button\"} />\n </button>\n </section>\n </form>\n );\n }\n}\n\nTopSiteForm.defaultProps = {\n TopSite: null,\n index: -1\n};\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/components/TopSites/TopSiteForm.jsx","import {actionCreators as ac, actionTypes as at} from \"common/Actions.jsm\";\nimport {perfService as perfSvc} from \"common/PerfService.jsm\";\n\nconst VISIBLE = \"visible\";\nconst VISIBILITY_CHANGE_EVENT = \"visibilitychange\";\n\nexport class DetectUserSessionStart {\n constructor(store, options = {}) {\n this._store = store;\n // Overrides for testing\n this.document = options.document || global.document;\n this._perfService = options.perfService || perfSvc;\n this._onVisibilityChange = this._onVisibilityChange.bind(this);\n }\n\n /**\n * sendEventOrAddListener - Notify immediately if the page is already visible,\n * or else set up a listener for when visibility changes.\n * This is needed for accurate session tracking for telemetry,\n * because tabs are pre-loaded.\n */\n sendEventOrAddListener() {\n if (this.document.visibilityState === VISIBLE) {\n // If the document is already visible, to the user, send a notification\n // immediately that a session has started.\n this._sendEvent();\n } else {\n // If the document is not visible, listen for when it does become visible.\n this.document.addEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n }\n\n /**\n * _sendEvent - Sends a message to the main process to indicate the current\n * tab is now visible to the user, includes the\n * visibility_event_rcvd_ts time in ms from the UNIX epoch.\n */\n _sendEvent() {\n this._perfService.mark(\"visibility_event_rcvd_ts\");\n\n try {\n let visibility_event_rcvd_ts = this._perfService\n .getMostRecentAbsMarkStartByName(\"visibility_event_rcvd_ts\");\n\n this._store.dispatch(ac.AlsoToMain({\n type: at.SAVE_SESSION_PERF_DATA,\n data: {visibility_event_rcvd_ts}\n }));\n } catch (ex) {\n // If this failed, it's likely because the `privacy.resistFingerprinting`\n // pref is true. We should at least not blow up.\n }\n }\n\n /**\n * _onVisibilityChange - If the visibility has changed to visible, sends a notification\n * and removes the event listener. This should only be called once per tab.\n */\n _onVisibilityChange() {\n if (this.document.visibilityState === VISIBLE) {\n this._sendEvent();\n this.document.removeEventListener(VISIBILITY_CHANGE_EVENT, this._onVisibilityChange);\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/detect-user-session-start.js","/* eslint-env mozilla/frame-script */\n\nimport {actionCreators as ac, actionTypes as at, actionUtils as au} from \"common/Actions.jsm\";\nimport {applyMiddleware, combineReducers, createStore} from \"redux\";\n\nexport const MERGE_STORE_ACTION = \"NEW_TAB_INITIAL_STATE\";\nexport const OUTGOING_MESSAGE_NAME = \"ActivityStream:ContentToMain\";\nexport const INCOMING_MESSAGE_NAME = \"ActivityStream:MainToContent\";\nexport const EARLY_QUEUED_ACTIONS = [at.SAVE_SESSION_PERF_DATA, at.PAGE_PRERENDERED];\n\n/**\n * A higher-order function which returns a reducer that, on MERGE_STORE action,\n * will return the action.data object merged into the previous state.\n *\n * For all other actions, it merely calls mainReducer.\n *\n * Because we want this to merge the entire state object, it's written as a\n * higher order function which takes the main reducer (itself often a call to\n * combineReducers) as a parameter.\n *\n * @param {function} mainReducer reducer to call if action != MERGE_STORE_ACTION\n * @return {function} a reducer that, on MERGE_STORE_ACTION action,\n * will return the action.data object merged\n * into the previous state, and the result\n * of calling mainReducer otherwise.\n */\nfunction mergeStateReducer(mainReducer) {\n return (prevState, action) => {\n if (action.type === MERGE_STORE_ACTION) {\n return Object.assign({}, prevState, action.data);\n }\n\n return mainReducer(prevState, action);\n };\n}\n\n/**\n * messageMiddleware - Middleware that looks for SentToMain type actions, and sends them if necessary\n */\nconst messageMiddleware = store => next => action => {\n const skipLocal = action.meta && action.meta.skipLocal;\n if (au.isSendToMain(action)) {\n sendAsyncMessage(OUTGOING_MESSAGE_NAME, action);\n }\n if (!skipLocal) {\n next(action);\n }\n};\n\nexport const rehydrationMiddleware = store => next => action => {\n if (store._didRehydrate) {\n return next(action);\n }\n\n const isMergeStoreAction = action.type === MERGE_STORE_ACTION;\n const isRehydrationRequest = action.type === at.NEW_TAB_STATE_REQUEST;\n\n if (isRehydrationRequest) {\n store._didRequestInitialState = true;\n return next(action);\n }\n\n if (isMergeStoreAction) {\n store._didRehydrate = true;\n return next(action);\n }\n\n // If init happened after our request was made, we need to re-request\n if (store._didRequestInitialState && action.type === at.INIT) {\n return next(ac.AlsoToMain({type: at.NEW_TAB_STATE_REQUEST}));\n }\n\n if (au.isBroadcastToContent(action) || au.isSendToOneContent(action) || au.isSendToPreloaded(action)) {\n // Note that actions received before didRehydrate will not be dispatched\n // because this could negatively affect preloading and the the state\n // will be replaced by rehydration anyway.\n return null;\n }\n\n return next(action);\n};\n\n/**\n * This middleware queues up all the EARLY_QUEUED_ACTIONS until it receives\n * the first action from main. This is useful for those actions for main which\n * require higher reliability, i.e. the action will not be lost in the case\n * that it gets sent before the main is ready to receive it. Conversely, any\n * actions allowed early are accepted to be ignorable or re-sendable.\n */\nexport const queueEarlyMessageMiddleware = store => next => action => {\n if (store._receivedFromMain) {\n next(action);\n } else if (au.isFromMain(action)) {\n next(action);\n store._receivedFromMain = true;\n // Sending out all the early actions as main is ready now\n if (store._earlyActionQueue) {\n store._earlyActionQueue.forEach(next);\n store._earlyActionQueue = [];\n }\n } else if (EARLY_QUEUED_ACTIONS.includes(action.type)) {\n store._earlyActionQueue = store._earlyActionQueue || [];\n store._earlyActionQueue.push(action);\n } else {\n // Let any other type of action go through\n next(action);\n }\n};\n\n/**\n * initStore - Create a store and listen for incoming actions\n *\n * @param {object} reducers An object containing Redux reducers\n * @param {object} intialState (optional) The initial state of the store, if desired\n * @return {object} A redux store\n */\nexport function initStore(reducers, initialState) {\n const store = createStore(\n mergeStateReducer(combineReducers(reducers)),\n initialState,\n global.addMessageListener && applyMiddleware(rehydrationMiddleware, queueEarlyMessageMiddleware, messageMiddleware)\n );\n\n store._didRehydrate = false;\n store._didRequestInitialState = false;\n\n if (global.addMessageListener) {\n global.addMessageListener(INCOMING_MESSAGE_NAME, msg => {\n try {\n store.dispatch(msg.data);\n } catch (ex) {\n console.error(\"Content msg:\", msg, \"Dispatch error: \", ex); // eslint-disable-line no-console\n dump(`Content msg: ${JSON.stringify(msg)}\\nDispatch error: ${ex}\\n${ex.stack}`);\n }\n });\n }\n\n return store;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./system-addon/content-src/lib/init-store.js","module.exports = Redux;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"Redux\"\n// module id = 26\n// module chunks = 0","module.exports = ReactDOM;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"ReactDOM\"\n// module id = 27\n// module chunks = 0"],"sourceRoot":""}