mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-01 13:09:31 +08:00
3 lines
5.8 KiB
JavaScript
3 lines
5.8 KiB
JavaScript
import{S as V,i as Y,s as ee,C as I,w as te,x as oe,y as ae,z as ne,A as D,f as re,t as se,B as ie,X as F,l,r as y,a as S,m as p,n as c,u as h,h as a,c as M,p as w,b as u,G as i,E as le}from"../../chunks/index-cd58b8d1.js";import{P as pe}from"../../chunks/post_layout-9085e57e.js";import"../../chunks/posts-c52cb603.js";import"../../chunks/title-765c989f.js";import"../../chunks/index-81c83cec.js";import"../../chunks/post_card-e7f4525a.js";import"../../chunks/posts-57ab4794.js";import"../../chunks/icon-3aa13b39.js";import"../../chunks/head-4a058b17.js";import"../../chunks/footer-1abd9501.js";function ce(_){let t,n,f,m,o,r,k,P,O,T,q,g,z,A,v,d,B,$,b,E,j,J,x,G;return{c(){t=l("p"),n=l("a"),f=y("Monkey Patch - Wikipedia"),m=S(),o=l("blockquote"),r=l("p"),k=y("A "),P=l("strong"),O=y("Monkey patch"),T=y(" is a way for a program to extend or modify supporting system software locally (affecting only the running instance of the program).\u201D"),q=S(),g=l("p"),z=y("\u4E5F\u53EF\u4EE5\u53EF\u4EE5\u7406\u89E3\u4E3A\u57FA\u4E8E\u539F\u751F\u529F\u80FD\uFF08API\uFF09\u7684\u4E00\u4E9B\u81EA\u5B9A\u4E49\u62D3\u5C55\uFF1F\u8FD9\u4E2A\u6982\u5FF5\u5E38\u5728 Python \u91CC\u9762\u51FA\u73B0\uFF0C\u4E5F\u53EB\u9E2D\u5B50\u53CC\u5173"),A=S(),v=l("p"),d=l("a"),B=y("Checking if a JavaScript native function is monkey patched"),$=S(),b=l("blockquote"),E=l("p"),j=y(`Monkey patching is a powerful but dangerous technique because the code you\u2019re overriding is not in your control: future updates to the JavaScript engine may break some assumptions made in your patch and cause serious bugs.
|
|
Additionally, by monkey patching code you don\u2019t own, you might override some code that has already been monkey patched by another developer, introducing a potential conflict.`),J=S(),x=l("p"),G=y("\u5BF9\u4E8E JS \u6765\u8BF4\uFF0CMonkey patch \u7684\u95EE\u9898\u5728\u4E8E\uFF1A\u5982\u679C JS \u5F15\u64CE\u66F4\u65B0\u4E86\uFF0C\u53EF\u80FD\u4F1A\u5E26\u6765\u4E00\u4E9B\u96BE\u4EE5\u9884\u8BA1\u7684 bug\uFF0C\u8FD9\u7BC7\u6587\u7AE0\u8BF4\u4E86\u51E0\u79CD\u600E\u4E48\u68C0\u6D4B\u662F\u5426\u5B58\u5728 monkey patch \u51FD\u6570\u7684\u65B9\u6CD5\uFF0C\u6BD4\u5982\u7528 toString\u3001iframe\u3001proxy \u7B49\u7B49\uFF0C\u4F46\u90FD\u4E0D\u662F\u5F88\u5B8C\u7F8E\uFF0C\u53EF\u4EE5\u6839\u636E\u4F7F\u7528\u573A\u666F\u6765\u51B3\u5B9A\u7528\u54EA\u79CD\u65B9\u6CD5"),this.h()},l(e){t=p(e,"P",{});var s=c(t);n=p(s,"A",{href:!0,rel:!0,target:!0});var K=c(n);f=h(K,"Monkey Patch - Wikipedia"),K.forEach(a),s.forEach(a),m=M(e),o=p(e,"BLOCKQUOTE",{});var L=c(o);r=p(L,"P",{});var C=c(r);k=h(C,"A "),P=p(C,"STRONG",{});var N=c(P);O=h(N,"Monkey patch"),N.forEach(a),T=h(C," is a way for a program to extend or modify supporting system software locally (affecting only the running instance of the program).\u201D"),C.forEach(a),L.forEach(a),q=M(e),g=p(e,"P",{});var Q=c(g);z=h(Q,"\u4E5F\u53EF\u4EE5\u53EF\u4EE5\u7406\u89E3\u4E3A\u57FA\u4E8E\u539F\u751F\u529F\u80FD\uFF08API\uFF09\u7684\u4E00\u4E9B\u81EA\u5B9A\u4E49\u62D3\u5C55\uFF1F\u8FD9\u4E2A\u6982\u5FF5\u5E38\u5728 Python \u91CC\u9762\u51FA\u73B0\uFF0C\u4E5F\u53EB\u9E2D\u5B50\u53CC\u5173"),Q.forEach(a),A=M(e),v=p(e,"P",{});var U=c(v);d=p(U,"A",{href:!0,rel:!0,target:!0});var W=c(d);B=h(W,"Checking if a JavaScript native function is monkey patched"),W.forEach(a),U.forEach(a),$=M(e),b=p(e,"BLOCKQUOTE",{});var Z=c(b);E=p(Z,"P",{});var R=c(E);j=h(R,`Monkey patching is a powerful but dangerous technique because the code you\u2019re overriding is not in your control: future updates to the JavaScript engine may break some assumptions made in your patch and cause serious bugs.
|
|
Additionally, by monkey patching code you don\u2019t own, you might override some code that has already been monkey patched by another developer, introducing a potential conflict.`),R.forEach(a),Z.forEach(a),J=M(e),x=p(e,"P",{});var X=c(x);G=h(X,"\u5BF9\u4E8E JS \u6765\u8BF4\uFF0CMonkey patch \u7684\u95EE\u9898\u5728\u4E8E\uFF1A\u5982\u679C JS \u5F15\u64CE\u66F4\u65B0\u4E86\uFF0C\u53EF\u80FD\u4F1A\u5E26\u6765\u4E00\u4E9B\u96BE\u4EE5\u9884\u8BA1\u7684 bug\uFF0C\u8FD9\u7BC7\u6587\u7AE0\u8BF4\u4E86\u51E0\u79CD\u600E\u4E48\u68C0\u6D4B\u662F\u5426\u5B58\u5728 monkey patch \u51FD\u6570\u7684\u65B9\u6CD5\uFF0C\u6BD4\u5982\u7528 toString\u3001iframe\u3001proxy \u7B49\u7B49\uFF0C\u4F46\u90FD\u4E0D\u662F\u5F88\u5B8C\u7F8E\uFF0C\u53EF\u4EE5\u6839\u636E\u4F7F\u7528\u573A\u666F\u6765\u51B3\u5B9A\u7528\u54EA\u79CD\u65B9\u6CD5"),X.forEach(a),this.h()},h(){w(n,"href","https://en.wikipedia.org/wiki/Monkey%20patch"),w(n,"rel","nofollow noopener noreferrer external"),w(n,"target","_blank"),w(d,"href","https://mmazzarolo.com/blog/2022-07-30-checking-if-a-javascript-native-function-was-monkey-patched/"),w(d,"rel","nofollow noopener noreferrer external"),w(d,"target","_blank")},m(e,s){u(e,t,s),i(t,n),i(n,f),u(e,m,s),u(e,o,s),i(o,r),i(r,k),i(r,P),i(P,O),i(r,T),u(e,q,s),u(e,g,s),i(g,z),u(e,A,s),u(e,v,s),i(v,d),i(d,B),u(e,$,s),u(e,b,s),i(b,E),i(E,j),u(e,J,s),u(e,x,s),i(x,G)},p:le,d(e){e&&a(t),e&&a(m),e&&a(o),e&&a(q),e&&a(g),e&&a(A),e&&a(v),e&&a($),e&&a(b),e&&a(J),e&&a(x)}}}function ue(_){let t,n;const f=[_[0],H];let m={$$slots:{default:[ce]},$$scope:{ctx:_}};for(let o=0;o<f.length;o+=1)m=I(m,f[o]);return t=new pe({props:m}),{c(){te(t.$$.fragment)},l(o){oe(t.$$.fragment,o)},m(o,r){ae(t,o,r),n=!0},p(o,[r]){const k=r&1?ne(f,[r&1&&D(o[0]),r&0&&D(H)]):{};r&2&&(k.$$scope={dirty:r,ctx:o}),t.$set(k)},i(o){n||(re(t.$$.fragment,o),n=!0)},o(o){se(t.$$.fragment,o),n=!1},d(o){ie(t,o)}}}const H={title:"Monkey Patch",created:"2022-08-06T00:00:00.000Z",summary:"\u7334\u5B50\u6253\u8865\u4E01",toc:!1,tag:["Notes"],slug:"/2022-08-06-notes/index.md",path:"/2022-08-06-notes",updated:"2022-08-07T04:36:02.907Z"};function fe(_,t,n){return _.$$set=f=>{n(0,t=I(I({},t),F(f)))},t=F(t),[t]}class we extends V{constructor(t){super(),Y(this,t,fe,ue,ee,{})}}export{we as default,H as metadata};
|