Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump engine.io and socket.io #45

Open
wants to merge 42 commits into
base: mococn
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3d3ab7c
Webpack: config to generate files for web hosting
l-hedgehog Dec 26, 2019
d187dc4
IS_MOCOCN_NEWTAB: similar to IS_NEWTAB
l-hedgehog Dec 26, 2019
ed5265c
Base: stop handoff searches to urlbar
l-hedgehog Apr 29, 2021
a639477
Base: stop (always) showing the Fx logo on top
l-hedgehog Apr 29, 2021
31d6210
Base: hide the sponsored topsites checkbox
l-hedgehog Apr 29, 2021
8ba9ebf
Base: turn DiscoveryStream on w/o relying on the extension
l-hedgehog Aug 20, 2021
c2347fa
Generic style tweaks
l-hedgehog Dec 26, 2019
3278094
CustomizeMenu: back compat fix
l-hedgehog Oct 27, 2021
62e5e5a
CustomizeMenu: hide unnecessary parts
l-hedgehog Apr 29, 2021
2576997
ErrorBoundary: subclass the one provided by Sentry
l-hedgehog Jun 9, 2021
59f820c
Highlights: always hide it
l-hedgehog Dec 26, 2019
ea0c59a
LinkMenu: alternative options
l-hedgehog Dec 26, 2019
5306b4a
Search: purpose is "newtab"
l-hedgehog Dec 26, 2019
4af3843
Search: show logo in more situations
l-hedgehog Dec 26, 2019
83e1bfb
Sections: card style, data & context menus
l-hedgehog Dec 26, 2019
287c4e4
Sections: other section level tweaks
l-hedgehog Dec 26, 2019
96c8481
TopSites: back compat fix
l-hedgehog Oct 15, 2020
9e2e033
TopSites: keep pinned sites only
l-hedgehog Dec 26, 2019
339a180
TopSites: defaults to use wide layout
l-hedgehog Dec 26, 2019
6c35d4c
TopSites: link context menu items
l-hedgehog Dec 26, 2019
2757a45
DSBase: section level tweaks for topstories
l-hedgehog Dec 27, 2019
e9a52f8
DSBase: stop (always) showing highlights
l-hedgehog May 12, 2021
5ea4f4c
DSCardGrid: show context as source
l-hedgehog Dec 27, 2019
5c97d19
DSLinkMenu: card context menus
l-hedgehog Dec 27, 2019
2586831
DSSafeAnchor: use an empty referrer, not pocket
l-hedgehog Dec 27, 2019
b5ae1e6
DSTopSites: style tweaks for wide layout
l-hedgehog Dec 26, 2019
d730bd4
Unused: ASRouterAdmin
l-hedgehog Apr 1, 2020
36208c1
Unused: ASRouter templates other than the simple ones
l-hedgehog Apr 1, 2020
7c9744f
Unused: PocketLoggedInCta
l-hedgehog Apr 1, 2020
d583bb6
Unused: SearchShortcutsForm
l-hedgehog Apr 1, 2020
6a948fb
MoCoCNPrefs: using localStorage
l-hedgehog Nov 16, 2020
6449c1e
MoCoCNPromo: initial implementation
l-hedgehog Oct 20, 2020
08a5cc1
Bug 2803: Fx 83 compat fix
l-hedgehog Nov 16, 2020
5816558
Bug 2818: Fx 84+ compat fix
l-hedgehog Mar 18, 2021
99f4292
Bug 2819: Fx 77 or earlier compat fix
l-hedgehog May 11, 2021
1091b02
Bug 2851: compat, `color-mix` not yet available to regular content
l-hedgehog Oct 19, 2021
7c024f3
Bug 2896: Fx 105 compat fix
l-hedgehog Oct 12, 2022
586ed86
Bug 2896: first attempt at fixing a flash in CustomizeMenu
l-hedgehog Oct 14, 2022
daef818
Bug 2913: coverage exception, not sure why this is necessary
l-hedgehog Jan 11, 2023
3a03b1e
Github action to run `webpack`
l-hedgehog Aug 16, 2021
318971e
Github action to run unit tests
l-hedgehog Aug 17, 2021
fc695d7
Bump engine.io and socket.io
dependabot[bot] Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Node.js CI

on:
push:
branches: [ 'mococn*' ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Karma-mocha
run: npm run testmc:unit

- name: Upload test logs
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ matrix.node-version }}
path: logs/
46 changes: 46 additions & 0 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: NodeJS with Webpack

on:
push:
branches: [ 'mococn*' ]

jobs:
build:
environment: prod
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 128

- name: Fetch necessary tags
run: git fetch --depth=1 origin 'refs/tags/firefox-*b:refs/tags/firefox-*b'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Webpack
env:
NODE_ENV: production
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_SAMPLE_RATE: ${{ secrets.SENTRY_SAMPLE_RATE }}
run: |
git describe --dirty
npx webpack -c webpack.china.config.js --mode production

- name: Upload built files
uses: actions/upload-artifact@v3
with:
name: prod
path: dist/
6 changes: 5 additions & 1 deletion common/Actions.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ for (const type of [
"HANDOFF_SEARCH_TO_AWESOMEBAR",
"HIDE_PRIVACY_INFO",
"INIT",
"MOCOCN_PREFS_INITIAL_VALUES",
"MOCOCN_PREF_CHANGED",
"MOCOCN_SET_PREF",
"NEW_TAB_INIT",
"NEW_TAB_INITIAL_STATE",
"NEW_TAB_LOAD",
Expand Down Expand Up @@ -299,8 +302,9 @@ function UserEvent(data) {
* @return {object} An AlsoToMain action
*/
function DiscoveryStreamUserEvent(data) {
// `DISCOVERY_STREAM_USER_EVENT` available since Fx 105, see https://bugzil.la/1779636
return AlsoToMain({
type: actionTypes.DISCOVERY_STREAM_USER_EVENT,
type: (typeof OffscreenCanvas === "function" ? actionTypes.DISCOVERY_STREAM_USER_EVENT : actionTypes.TELEMETRY_USER_EVENT),
data,
});
}
Expand Down
19 changes: 19 additions & 0 deletions common/Reducers.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const INITIAL_STATE = {
// The list of available search shortcuts.
searchShortcuts: [],
},
MoCoCNPrefs: {
initialized: false,
values: {},
},
Prefs: {
initialized: false,
values: { featureConfig: {} },
Expand Down Expand Up @@ -293,6 +297,20 @@ function Dialog(prevState = INITIAL_STATE.Dialog, action) {
}
}

function MoCoCNPrefs(prevState = INITIAL_STATE.MoCoCNPrefs, action) {
let newValues;
switch (action.type) {
case at.MOCOCN_PREFS_INITIAL_VALUES:
return Object.assign({}, prevState, {initialized: true, values: action.data});
case at.MOCOCN_PREF_CHANGED:
newValues = Object.assign({}, prevState.values);
newValues[action.data.name] = action.data.value;
return Object.assign({}, prevState, {values: newValues});
default:
return prevState;
}
}

function Prefs(prevState = INITIAL_STATE.Prefs, action) {
let newValues;
switch (action.type) {
Expand Down Expand Up @@ -843,6 +861,7 @@ const reducers = {
App,
ASRouter,
Snippets,
MoCoCNPrefs,
Prefs,
Dialog,
Sections,
Expand Down
61 changes: 60 additions & 1 deletion content-src/activity-stream.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,58 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import "content-src/styles/activity-stream-mac.scss";
import "content-src/styles/mococn.scss";

import "mococn/fluent-web";

import "gecko-dev/contentSearchUI";
import "gecko-dev/contentSearchHandoffUI";
import "gecko-dev/contentTheme";

import { actionCreators as ac, actionTypes as at } from "common/Actions.jsm";
import { Base } from "content-src/components/Base/Base";
import { DetectUserSessionStart } from "content-src/lib/detect-user-session-start";
import { initStore } from "content-src/lib/init-store";
import { initStore, initMoCoCNPrefs } from "content-src/lib/init-store";
import { Provider } from "react-redux";
import React from "react";
import ReactDOM from "react-dom";
import { reducers } from "common/Reducers.jsm";
import * as Sentry from "@sentry/react";

if (SENTRY_DSN) {
Sentry.init({
beforeSend(event, hint) {
try {
if (
hint &&
hint.originalException &&
hint.originalException.message === "Element is not a row"
) {
let [arg0] = event.extra.arguments;
if (
arg0.type === "mouseout" && [
"table#searchSuggestionTable.contentSearchSuggestionTable",
"table.contentSearchOneOffsTable.contentSearchSuggestionsContainer",
].includes(arg0.target)
) {
return null;
}
}
} catch (ex) {
global.console.error(ex);
}
return event;
},
denyUrls: [
/^moz-extension:\/\//i,
],
dsn: SENTRY_DSN,
environment: SENTRY_ENVIRONMENT,
release: SENTRY_RELEASE,
sampleRate: SENTRY_SAMPLE_RATE,
});
}

export const NewTab = ({ store }) => (
<Provider store={store}>
Expand All @@ -19,6 +63,7 @@ export const NewTab = ({ store }) => (

export function renderWithoutState() {
const store = initStore(reducers);
initMoCoCNPrefs(store);
new DetectUserSessionStart(store).sendEventOrAddListener();

// If this document has already gone into the background by the time we've reached
Expand Down Expand Up @@ -48,7 +93,21 @@ export function renderWithoutState() {

export function renderCache(initialState) {
const store = initStore(reducers, initialState);
initMoCoCNPrefs(store);
new DetectUserSessionStart(store).sendEventOrAddListener();

ReactDOM.hydrate(<NewTab store={store} />, document.getElementById("root"));
}

// Equivalent to that from data/content/newtab-render.js ?
renderWithoutState();

if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("service-worker.js").then(registration => {
global.console.log("SW registered: ", registration);
}).catch(registrationError => {
global.console.log("SW registration failed: ", registrationError);
});
});
}
8 changes: 7 additions & 1 deletion content-src/asrouter/asrouter-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ export const ASRouterUtils = {
if (global.ASRouterMessage) {
return global.ASRouterMessage(action);
}
throw new Error(`Unexpected call:\n${JSON.stringify(action, null, 3)}`);

// `window.ASRouterMessage` might be undefined on Fx 84+, as a result
// of not up-to-date extension, see https://bugzil.la/1614465
global.console.error(
new Error(`Unexpected call:\n${JSON.stringify(action, null, 3)}`)
);
return global.Promise.resolve({ message: {} });
},
blockById(id, options) {
return ASRouterUtils.sendMessage({
Expand Down
12 changes: 0 additions & 12 deletions content-src/asrouter/templates/template-manifest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import { EOYSnippet } from "./EOYSnippet/EOYSnippet";
import { FXASignupSnippet } from "./FXASignupSnippet/FXASignupSnippet";
import { NewsletterSnippet } from "./NewsletterSnippet/NewsletterSnippet";
import {
SendToDeviceSnippet,
SendToDeviceScene2Snippet,
} from "./SendToDeviceSnippet/SendToDeviceSnippet";
import { SimpleBelowSearchSnippet } from "./SimpleBelowSearchSnippet/SimpleBelowSearchSnippet";
import { SimpleSnippet } from "./SimpleSnippet/SimpleSnippet";

// Key names matching schema name of templates
export const SnippetsTemplates = {
simple_snippet: SimpleSnippet,
newsletter_snippet: NewsletterSnippet,
fxa_signup_snippet: FXASignupSnippet,
send_to_device_snippet: SendToDeviceSnippet,
send_to_device_scene2_snippet: SendToDeviceScene2Snippet,
eoy_snippet: EOYSnippet,
simple_below_search_snippet: SimpleBelowSearchSnippet,
};
Loading