vitvad / Access-Control-Allow-Origin

Chrome extension: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi
213 stars 73 forks source link

Fixes #36 #37

Open seedofjoy opened 8 years ago

seedofjoy commented 8 years ago

Fix resetting settings to default when you upgrade your browser.

jdart commented 8 years ago

Those defaults might be set for a reason, maybe something like the below would be safer. This is completely untested!

chrome.storage.local.get('active', function(value) {
  if (!chrome.runtime.lastError) // storage already set
    return;
  chrome.storage.local.set({
    active: false,
    urls: ["<all_urls>"],
    exposedHeaders: ''
  });
});
jdart commented 8 years ago

@vitvad How does my above comment look to you?

jdart commented 8 years ago

resolves #36

seedofjoy commented 8 years ago

@jdart my code doesn't broke anything because of this: chrome.storage.local.get({'active': false, 'urls': ["<all_urls>"], 'exposedHeaders': ''}, function(result) { - this is single place where settings are used (with default settings)

jdart commented 8 years ago

Oh cool, well, I'd love to see this merged!