You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
λ diff extension\dist\js\browser-polyfill.js src\modules_js\browser-polyfill.js
14c14
< /* webextension-polyfill - v0.2.1 - Thu Oct 12 2017 12:31:04 */
---
> /* webextension-polyfill - v0.2.1 - Mon May 28 2018 12:29:17 */
271a272,277
> "identity": {
> "launchWebAuthFlow": {
> "minArgs": 1,
> "maxArgs": 1
> }
> },
322a329,333
> "setPopup": {
> "minArgs": 1,
> "maxArgs": 1,
> "fallbackToNoCallback": true
> },
326a338,342
> "setTitle": {
> "minArgs": 1,
> "maxArgs": 1,
> "fallbackToNoCallback": true
> },
328,329c344,346
< "minArgs": 0,
< "maxArgs": 0
---
> "minArgs": 1,
> "maxArgs": 1,
> "fallbackToNoCallback": true
334a352,355
> "getIcon": {
> "minArgs": 1,
> "maxArgs": 1
> },
336,337c357,359
< "minArgs": 0,
< "maxArgs": 0
---
> "minArgs": 1,
> "maxArgs": 1,
> "fallbackToNoCallback": true
674c696,719
< target[name](...args, makeCallback({ resolve, reject }, metadata));
---
> if (metadata.fallbackToNoCallback) {
> // This API method has currently no callback on Chrome, but it return a promise on Firefox,
> // and so the polyfill will try to call it with a callback first, and it will fallback
> // to not passing the callback if the first call fails.
> try {
> target[name](...args, makeCallback({ resolve, reject }, metadata));
> } catch (cbError) {
> console.warn(`${name} API method doesn't seem to support the callback parameter, ` + "falling back to call it without a callback: ", cbError);
>
> target[name](...args);
>
> // Update the API method metadata, so that the next API calls will not try to
> // use the unsupported callback anymore.
> metadata.fallbackToNoCallback = false;
> metadata.noCallback = true;
>
> resolve();
> }
> } else if (metadata.noCallback) {
> target[name](...args);
> resolve();
> } else {
> target[name](...args, makeCallback({ resolve, reject }, metadata));
> }
733d777
<
735c779
< has(target, prop) {
---
> has(proxyTarget, prop) {
739c783
< get(target, prop, receiver) {
---
> get(proxyTarget, prop, receiver) {
793c837
< set(target, prop, value, receiver) {
---
> set(proxyTarget, prop, value, receiver) {
802c846
< defineProperty(target, prop, desc) {
---
> defineProperty(proxyTarget, prop, desc) {
806c850
< deleteProperty(target, prop) {
---
> deleteProperty(proxyTarget, prop) {
811c855,866
< return new Proxy(target, handlers);
---
> // Per contract of the Proxy API, the "get" proxy handler must return the
> // original value of the target if that value is declared read-only and
> // non-configurable. For this reason, we create an object with the
> // prototype set to `target` instead of using `target` directly.
> // Otherwise we cannot return a custom object for APIs that
> // are declared read-only and non-configurable, such as `chrome.devtools`.
> //
> // The proxy handlers themselves will still use the original `target`
> // instead of the `proxyTarget`, so that the methods and properties are
> // dereferenced via the original targets.
> let proxyTarget = Object.create(target);
> return new Proxy(proxyTarget, handlers);
867c922
< let result = listener(message, sender);
---
> let didCallSendResponse = false;
869c924,946
< if (isThenable(result)) {
---
> let wrappedSendResponse;
> let sendResponsePromise = new Promise(resolve => {
> wrappedSendResponse = function (response) {
> didCallSendResponse = true;
> resolve(response);
> };
> });
>
> let result = listener(message, sender, wrappedSendResponse);
>
> const isResultThenable = result !== true && isThenable(result);
>
> // If the listener didn't returned true or a Promise, or called
> // wrappedSendResponse synchronously, we can exit earlier
> // because there will be no response sent from this listener.
> if (result !== true && !isResultThenable && !didCallSendResponse) {
> return false;
> }
>
> // If the listener returned a Promise, send the resolved value as a
> // result, otherwise wait the promise related to the wrappedSendResponse
> // callback to resolve and send it as a response.
> if (isResultThenable) {
872c949,961
< sendResponse(error);
---
> // TODO: the error object is not serializable and so for now we just send
> // `undefined`. Nevertheless, as being discussed in #97, this is not yet
> // providing the expected behavior (the promise received from the sender should
> // be rejected when the promise returned by the listener is being rejected).
> sendResponse(undefined);
> });
> } else {
> sendResponsePromise.then(sendResponse, error => {
> console.error(error);
> // TODO: same as above, we are currently sending `undefined` in this scenario
> // because the error oject is not serializable, but it is not yet the behavior
> // that this scenario should present.
> sendResponse(undefined);
874,877d962
<
< return true;
< } else if (result !== undefined) {
< sendResponse(result);
878a964,966
>
> // Let Chrome know that the listener is replying.
> return true;
888,893c976
< // Create a new empty object and copy the properties of the original chrome object
< // to prevent a Proxy violation exception for the devtools API getter
< // (which is a read-only non-configurable property on the original target).
< const targetObject = Object.assign({}, chrome);
<
< return wrapObject(targetObject, staticWrappers, apiMetadata);
---
> return wrapObject(chrome, staticWrappers, apiMetadata);
The text was updated successfully, but these errors were encountered:
Hello, there is a difference between npm and git, please update.
npm
content-script
background
always return
true
in chrome.git
Everything works fine
diff
The text was updated successfully, but these errors were encountered: