-
Notifications
You must be signed in to change notification settings - Fork 49
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
新增 mip 前端小流量机制 #560
新增 mip 前端小流量机制 #560
Conversation
Pull Request Test Coverage Report for Build 1001
💛 - Coveralls |
var domain = document.domain | ||
let date = new Date() | ||
date.setTime(Date.now() + expires) | ||
document.cookie = `${key}=${escape(value)};path=/;expires=${date.toGMTString()};domain=${domain};` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
escape 应该用 encodeURIComponent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方不是对 URI 类型的串进行转义的,由于前端操作 cookie 安全性要求更高, escape 的转义更全面,https://stackoverflow.com/questions/14317861/difference-between-escape-encodeuri-encodeuricomponent
let arr = document.cookie.match(reg) | ||
|
||
if (arr && arr[2]) { | ||
return unescape(arr[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decodeURIComponent,同上
packages/mip/src/experiment/index.js
Outdated
} | ||
|
||
for (let i = 0; i < 100; i++) { | ||
abArr[i] = (i < ratio) ? 1 : 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abArr 命名有点看不懂
另外 abArr = Array.from(Array(100), (_, i) => +(i < ratio))
应该就行了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
核心不是不支持 Array.from?
实验机制专用测试分支为 dev-test-experiment, 此分支可以进行修改 注意:
机制方案详见 issue:#559 |
测试内容 站点实验: 异常值(cr会发现,不重点): Abtest实验: 二、百分比设置
测试配置如下: 测试完成,通过 |
* feat: 新增 mip 前端小流量机制 * 修改注释 * 调整变量名和 cookie 的失效时间
* fix: 修复核心全量后已知 bugs (#546) * fix: mip 链接使用默认行为 (#548) * fix: Register built-in components when document interactive (#555) * fix: Fix external resources protocol (#558) * feat: 增强 templates 判断逻辑 (#567) * 新增 mip 前端小流量机制 (#560) * feat: 新增 mip 前端小流量机制 * 修改注释 * 调整变量名和 cookie 的失效时间 * fixed: 无需在 js 中指向 mip cahce url * mip.js 沙盒对象增加 BMap\BMapLib (#577) * 增加 sandbox 白名单 * 将 BMap 改成 readywrite * 升级 mip.js 核心的 sandbox * MIP 核心中移除 Vue 代码 (#357)
* mip 核心升级 babel v7 * 去除多余配置和模块 * 删掉多余注释 * 更新 mip-compoenents-webpack-helpers * 将 css-loader 锁在0.28 * fix: 修复核心全量后已知 bugs (#546) * 增加 symbol 的 polyfill * 增加注释 * fix: mip 链接使用默认行为 (#548) * 把 symbol 加上 * lock babel version * add component helper version * 升级 component helpers 版本 * fix: Register built-in components when document interactive (#555) * fix: Fix external resources protocol (#558) * 修改test case * 修改 test case * add sleep * feat: 增强 templates 判断逻辑 (#567) * 新增 mip 前端小流量机制 (#560) * feat: 新增 mip 前端小流量机制 * 修改注释 * 调整变量名和 cookie 的失效时间 * fixed: 无需在 js 中指向 mip cahce url * mip.js 沙盒对象增加 BMap\BMapLib (#577) * 增加 sandbox 白名单 * 将 BMap 改成 readywrite * 升级 mip.js 核心的 sandbox * update * add promise finally polyfill * 挪个位置 * 消除其他影响 * change position * recover test case * readd maintemplate * MIP 核心中移除 Vue 代码 (#357) * mip-img 支持调起手百图片浏览器 (#587) * mip-img 支持调起手百图片浏览器 * fix: Fix base url calculation (#590) * update helper * update helper * 修改 mip-img 手百调起逻辑 (#592) * 修改调起逻辑 * mip-img 修复滑动调起 (#597) * 修复滑动调起
相关 ISSUE: (ISSUE 链接地址)
#559
1、升级点 (清晰准确的描述升级的功能点)
新增前端小流量机制
2、影响范围 (描述该需求上线会影响什么功能)
暂时不会对线上造成影响
3、自测 Checklist
4、需要覆盖的场景和 Case
5、自测机型和浏览器