gregsadetsky / chrome-dont-add-custom-search-engines

Google Chrome extension that stops sites from adding custom search engines
https://chrome.google.com/webstore/detail/dont-add-custom-search-en/dnodlcololidkjgbpeoleabmkocdhacc
Other
118 stars 12 forks source link

Breaks uk.webuy.com #12

Closed cxw42 closed 6 years ago

cxw42 commented 6 years ago

Reported by Dan Reeves via web store 2018/04/08.

When the extension is not loaded:

screenshot

When the extension is loaded:

image

Procyon-b commented 6 years ago

I have tested with this particular page, and I think we want the part 'spoilFormGet' to be start after body.onload. I don't know what the scripts on this page do, but the form completely disappears. document.forms.length is equal to 0 after the "fix"

In main(), enclose the document.querySelectorAll('form:-webkit-any(... if(DEBUG) {... }

inside a: window.addEventListener('load', function(){ [paste old code here] } );

And all is good afterwards

cxw42 commented 6 years ago

@Procyon-b thanks very much for the fix! Would you be willing to submit a pull request so your name will be in the commit history? Either way, I'll try it out and see if I have the same results.

Procyon-b commented 6 years ago

You'll have to tell me how to do it. I'm new here. I have created an account just for this. :) I haven't looked around yet.

cxw42 commented 6 years ago

Ah! Welcome, and thanks very much for going to the effort! Are you using command-line Git or a different client? I will find you an appropriate tutorial.

The first step, regardless, is to hit the "Fork" button in the upper right. That will create https://github.com/Procyon-b/chrome-dont-add-custom-search-engines. With whatever Git client you're using, you clone that repo, create a branch, commit your changes, and push the branch. Then, in the GitHub web interface, on that repo page or this one, you will see a yellow banner with the name of your branch that says "Create pull request." Hit that and I can take it the rest of the way.

Just as a reminder, whatever name/email you use in your Git configuration is visible in your commits. If you want to stay anonymous, make sure those are set the way you want before committing :) .

Procyon-b commented 6 years ago

I'm not using a client yet. Just the web interface. I don't have the time right now, but I'll look at it.

cxw42 commented 6 years ago

OK - no worries! Here's the doc for using GitHub desktop. If I get to it first, I'll let you know :) . Last thing for today --- would you be willing to attach your edited source file to this thread? That way I can test exactly what you are using.

Procyon-b commented 6 years ago

content.zip

Sorry for the delay, I'm back now. Here is a copy of a modified content.js

cxw42 commented 6 years ago

@Procyon-b Didn't notice the delay - I was working on my day job ;) . Received with thanks! I'll try it out.

Procyon-b commented 6 years ago

I have made some tests, And I think we can add a test to only do "spoilFormGet" when current page's pathname is '/'. From what I read on https://www.chromium.org/tab-to-search and tests, I can tell you that chrome follows rules of point 2, except for the case when there is an onsubmit script. If we have a list of test pages we can foolproof this assertion.

Procyon-b commented 6 years ago

Any activity ? Have you seen my pull request. Have I done it correctly ? I have been running that version of content.js , and so far no custom search added.

cxw42 commented 6 years ago

:) Been buried at work - I'm sorry to say I haven't had a chance. Will as soon as I can, though! I certainly don't want to leave you hanging. Thanks for your patience!

Procyon-b commented 6 years ago

No need to be sorry. I wasn't certain it was done correctly. That's all. :)